Change the checked and unchecked icons for the checkbox for Android

Instead of having a checkmark for the icon, I want a regular star (I have marked and marked icons). Can this be done through ownership? Or should I declare a custom widget that comes from the checkbox?

+56
java android checkbox icons
Jul 07 2018-10-10T00:
source share
4 answers

Type of mixture:

Install it in the layout file: -

<CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="new checkbox" android:background="@drawable/checkbox_background" android:button="@drawable/checkbox" /> 

where the @ drawable / checkbox will look like this:

 <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:state_focused="true" android:drawable="@drawable/checkbox_on_background_focus_yellow" /> <item android:state_checked="false" android:state_focused="true" android:drawable="@drawable/checkbox_off_background_focus_yellow" /> <item android:state_checked="false" android:drawable="@drawable/checkbox_off_background" /> <item android:state_checked="true" android:drawable="@drawable/checkbox_on_background" /> </selector> 
+150
Jul 07 '10 at 8:33
source share

it android:button="@drawable/selector_checkbox" to make it work

+9
Jun 24 '15 at 17:12
source share

I understand that this is an old question, and the OP talks about using custom gx, which is not a mandatory β€œ-looking” flag, but there is a fantastic resource for creating custom color assets here: http://kobroor.pl/

Just give him the relevant information, and he will lay out the graphics, complete with XML resources, which you can simply paste right into.

+6
Mar 04 '14 at 19:54
source share

One alternative would be to use drawable / textview instead of the checkbox and manipulate it accordingly. I used this method to have my own verified and unverified images for the task application.

+2
Jul 07 2018-10-10T00:
source share



All Articles