1) create [drawablename].xml under /res/drawable
eg: hdr_tick_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_checked="true" android:drawable="@drawable/hdr_tick_sl" />
<item android:state_pressed="true" android:drawable="@drawable/hdr_tick_hover"/>
<item android:drawable="@drawable/hdr_tick_dsl" />
</selector>
2) added check box to layout. set the drawable to button
eg:
<CheckBox
android:id="@+id/hdr_checkbox"
android:layout_gravity="center_vertical"
android:button="@drawable/hdr_tick_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dp"
android:layout_marginTop="5dp"
android:focusable="false"
android:visibility="gone"
android:focusableInTouchMode="false"/>
No comments:
Post a Comment