添加2张chebox图片。
在res资源文件夹中新建drawable文件夹,在其下建立chaebox_style.xml文件
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/checkbox_true" android:state_checked="true" /><span style="white-space:pre"> </span>//选中状态
<item android:drawable="@drawable/checkbox_false" android:state_checked="false" /> //未选中状态
<item android:drawable="@drawable/checkbox_false" /><span style="white-space:pre"> </span>//默认状态
</selector>
在style文件中加入样式
<style name="CustomCheckboxTheme" parent="@android:style/Widget.CompoundButton.CheckBox">
<item name="android:button">@drawable/checkbox_style</item>
</style>
在<chebox />属性中加入样式
style="@style/chackbox"