AkashG solution does not work for me. When I set check.xml for the background, it just splits in the vertical direction. To solve this problem, you should configure check.xml to the "android: button" property:
<ToggleButton android:id="@+id/toggle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:button="@drawable/check" //check.xml android:background="@null"/>
check.xml:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/selected_image" android:state_checked="true" /> <item android:drawable="@drawable/unselected_image" android:state_checked="false"/> </selector>
MistaGreen Jul 31 '13 at 3:16 2013-07-31 03:16
source share