Month: December 2013

[QA] How to customize checkbox image

<CheckBox
   android:id="@+id/checkbox"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:button="@drawable/btn_star"
   android:gravity="center_vertical|center_horizontal" />

btn_star.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/btn_star_off_normal"
android:state_checked="false"
android:state_window_focused="false" />
<item android:drawable="@drawable/btn_star_on_normal"
android:state_checked="true"
android:state_window_focused="false" />
 
<item android:drawable="@drawable/btn_star_on_pressed"
android:state_checked="true"
android:state_pressed="true" />
<item android:drawable="@drawable/btn_star_off_pressed"
android:state_checked="false"
android:state_pressed="true" />
 
<item android:drawable="@drawable/btn_star_on_focused"
android:state_checked="true"
android:state_focused="true" />
<item android:drawable="@drawable/btn_star_off_focused"
android:state_checked="false"
android:state_focused="true" />
 
<item android:state_checked="false" android:drawable="@drawable/btn_star_off_normal" />
<item android:state_checked="true" android:drawable="@drawable/btn_star_on_normal" />
</selector>
Tags : ,