定义一个selecter选择器
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_checked="false" android:drawable="@drawable/select_clerk_zmyfalse"></item>
<item android:state_checked="true" android:drawable="@drawable/select_clerk_zmyok"></item>
</selector>
在layout中引用
android:button="@drawable/user_checkbox_selector"这句话就将样式改变了
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:button="@drawable/user_checkbox_selector"
android:text="全选"
android:textColor="#919191" />