Below is a brief introduction to how to change the background picture of a checkbox in Androdi, you can customize the style
1, first res/drawable in the definition of writing the following style of XML, named: Checkbox_style:
1 <?XML version= "1.0" encoding= "Utf-8"?>2 <selectorxmlns:android= "Http://schemas.android.com/apk/res/android">3 <Itemandroid:drawable= "@drawable/checkbox2"android:state_checked= "true"></Item>4 <Itemandroid:drawable= "@drawable/checkbox"android:state_checked= "false"></Item>5 <Itemandroid:drawable= "@drawable/checkbox"/> 6 </selector>
2. Then add the checkbox control to the layout file as follows:
1 <CheckBox2 Android:id= "@+id/checkbox1"3 Android:layout_width= "Wrap_content"4 Android:layout_height= "Wrap_content"5 android:layout_centervertical= "true"6 Android:button= "@null"7 Android:background= "@drawable/checkbox_style" />
Where Drwable/checkbox_style is the XML name for the style file that defines the checkbox, Android:button must also be set to @null. Otherwise, the check-in style of Android comes with it. You can test to see @drawable/checkbox as checkbox unselected picture, @drawable/checkbox2 as checkbox selected picture
Customizing the Android Style checkbox