先在drawable下创建一个selector 选中为true 否则为false
<?xml version="1.0" encoding="utf-8"?>
< selector xmlns:android="http://schemas.android.com/apk/res/android">
< item
android:drawable="@drawable/ic_check_circle_black_24dp"
android:state_checked="true"/>
< item
android:drawable="@drawable/ic_panorama_fish_eye_black_24dp"
android:state_checked="false"/>
< /selector>
在style里声明
<style name="checkbox2" parent="@android:style/Widget.CompoundButton.CheckBox">
<item name="android:button">@drawable/check_box_changed</item>
</style>
最后在布局中用
<CheckBox
android:id="@+id/car_check_all"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/checkbox2" />