第一步
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/img_userinfo_selected" android:state_checked="true"/>
<item android:drawable="@drawable/img_userinfo_unselected" android:state_checked="false"/>
<item android:drawable="@drawable/img_userinfo_selected"/>
</selector>
第二步
<style name="CustomCheckboxTheme" parent="@android:style/Widget.CompoundButton.CheckBox">
<item name="android:button">@drawable/checkbox_style</item>
</style>
第三步
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/requestfriend"
android:layout_marginRight="50dp"
style="@style/CustomCheckboxTheme"/>