1. Create it in the drawable folder
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:drawable="@mipmap/yes_select"/> <item android:drawable="@mipmap/no_select"/> </selector>
In 2.xml, one is selected by default and the other is not selected android :button= "@drawable/sl_report_check" The folder name created
<CheckBox android:button="@drawable/sl_report_check" android:layout_weight="1" android:checked="true" android:text="垃圾营销" android:layout_marginTop="20dp" android:layout_marginLeft="16dp" android:textColor="#4A4A4A" /> <CheckBox android:button="@drawable/sl_report_check" android:layout_weight="1" android:text="不实信息" android:layout_marginTop="20dp" android:textColor="#4A4A4A" />