I solved it as follows. I created a file in res/drawable called btn_star_selector.xml and defined the selector as follows:
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:state_pressed="true" android:drawable="@drawable/btn_star_on_pressed" /> <item android:state_checked="false" android:state_pressed="true" android:drawable="@drawable/btn_star_off_pressed" /> <item android:state_checked="true" android:drawable="@drawable/btn_star_on" /> <item android:state_checked="false" android:drawable="@drawable/btn_star_off" /> </selector>
With this selector, I replaced this line in the checkbox definition
style="?android:attr/starStyle"
with this
android:button="@drawable/btn_star_selector"
Then I created four images to represent the various states of the checkbox, namely on , off , on pressed and off pressed , and also placed them in res/drawables .
Hope this helps someone else who is trying to figure out how to configure the checkboxes.
source share