1. First add the drawable file Checkbox_style.xml in the Drawable folder.
- <? XML version="1.0" encoding="Utf-8" ?>
- < selector xmlns:android="http://schemas.android.com/apk/res/android" >
- < Item android:drawable="@drawable/checkbox_pressed" android:state_ Checked="true"/>
- < Item android:drawable="@drawable/checkbox_normal" android:state_checked="false"/>
- < Item android:drawable="@drawable/checkbox_normal"/>
- </ selector >
2. Add the Customcheckboxtheme style to the Styles.xml file under the Values folder.
- < style name="customcheckboxtheme" parent="@android : Style/widget.compoundbutton.checkbox ">
- < Item name="Android:button">@drawable/checkbox_style </item >
- </ style >
3. Use the Customcheckboxtheme style in the layout file.
- < CheckBox
- Android:id = "@+id/select_all"
- Android:layout_width = "Wrap_content"
- Android:layout_height = "Wrap_content"
- style = "@style/customcheckboxtheme" />
Picture resources to use
Checkbox_normal.png
Checkbox_pressed.png