If you want to do with shapes (without using images) try this. Currently im using it in a custom checkbox
<com.myapp.views.MyCheckBox xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:button="@null"
android:checked="false"
android:clickable="false"
android:drawableRight="@drawable/checkbox_selector"
android:focusable="false"
android:textColor="@color/orange" />
checkbox_selector.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/toggle_button_off" /> <!-- pressed -->
<item android:state_checked="true"
android:drawable="@drawable/toggle_button_on" /> <!-- focused -->
<!-- default -->
<item
android:drawable="@drawable/toggle_button_off" />
</selector>
toggle_button_off.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/toggle_background_off"></item>
<item
android:drawable="@drawable/white_toggle_icon"
android:left="2dp"
android:right="27.5dp"
android:bottom="1.5dp"
android:top="1.5dp"></item>
</layer-list>
toggle_button_on.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/toggle_background_on"></item>
<item
android:drawable="@drawable/white_toggle_icon"
android:right="2dp"
android:left="27.5dp"
android:bottom="1.5dp"
android:top="1.5dp"></item>
</layer-list>
toggle_background_off.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size android:height="32dp" android:width="60dp"/>
<solid android:width="1dp" android:color="#919090"/>
<corners android:radius="18dp" />
</shape>
toggle_background_on.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size android:height="32dp" android:width="60dp"/>
<solid android:width="1dp" android:color="@color/orange"/>
<corners android:radius="18dp" />
</shape>
white_toggle_icon.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#ffffff"/>
<stroke android:width="2dp" android:color="#fff" />
<size android:width="25dp" android:height="25dp"/>
</shape>