How can i make the checkbox as like the image in android. can anyone help me?
Asked
Active
Viewed 60 times
-2
-
3[What have you tried?](http://mattgemmell.com/what-have-you-tried/) Also, who upvoted this? This is far too broad. – elixenide Jan 26 '15 at 05:51
-
1http://stackoverflow.com/questions/3965484/custom-checkbox-image-android try this~ – Jclick Jan 26 '15 at 05:57
-
YOU need to show what you tried first!! – AADProgramming Jan 26 '15 at 07:24
1 Answers
1
First: In you res/drawable
folder, create "custom_checkbox.xml"
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/cbox" android:state_checked="false"/>
<item android:drawable="@drawable/cbox_selected" android:state_checked="true"/>
<item android:drawable="@drawable/cbox"/>
</selector>
Second: In you res/drawable-hdpi
folder, paste two files named "cbox.png(which is unselected image of checkbox) and cbox_selected.png(which is selected Image of checkbox)"
Third: Now in you checkbox declaration
<CheckBox
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:button="@drawable/custom_checkbox" />

Murtaza Khursheed Hussain
- 15,176
- 7
- 58
- 83