How to change default images of CheckBox

Drawable customdrawablecheckbox.xml:

<?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/unchecked_drawable" />
     <item android:state_checked="true" android:drawable="@drawable/checked_drawable" />
     <item android:drawable="@drawable/unchecked_drawable" /> <!-- default state -->
</selector>

yourcheckbox xml:

<CheckBox
    android:id="@+id/chk"
    android:button="@drawable/customdrawablecheckbox"
    android:layout_alignParentLeft="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

Leave a Comment