Custom checkbox image android
Create a drawable checkbox selector:
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@drawable/checkbox" android:state_checked="false"/> <item android:drawable="@drawable/checkboxselected" android:state_checked="true"/> <item android:drawable="@drawable/checkbox"/> </selector>
Make sure your checkbox is like this android:button="@drawable/checkbox_selector"
<CheckBox android:layout_width="match_parent" android:layout_height="wrap_content" android:button="@drawable/checkbox_selector" android:text="CheckBox" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="@color/Black" />
Copy the btn_check.xml from android-sdk/platforms/android-#/data/res/drawable to your project's drawable folder and change the 'on' and 'off' image states to your custom images.
Then your xml will just need android:button="@drawable/btn_check"
<CheckBox android:button="@drawable/btn_check" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" />
If you want to use different default android icons, you can use android:button="@android:drawable/..."