Apply star style to checkbox on Android

style="?android:attr/starStyle" 

After applying this code to the attributes of a flag, I cannot view this flag. Is there a mistake in the code?

+4
source share
2 answers

Publish your full xml file. It works for me:

 <CheckBox android:id="@+id/checkBox1" android:layout_width="wrap_content" android:layout_height="wrap_content" style="?android:attr/starStyle" android:text="CheckBox" /> 
+9
source

check below code, this may help you ...

in your layout file where the checkbox is checked ...

 <CheckBox android:id="@+id/Check" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:layout_marginLeft="5dp" android:text=" Not connected " android:textSize="14sp" android:textStyle="bold" android:textColor="#ccc" android:clickable="true" android:focusable="true" android:button="@drawable/check"/> 

in R / drawable / check.xml - use your star images here instead of my image.

 <?xml version="1.0" encoding="UTF-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:state_window_focused="true" android:state_enabled="true" android:drawable="@drawable/check_on" /> <item android:state_checked="false" android:state_window_focused="true" android:state_enabled="true" android:drawable="@drawable/check_off" /> </selector> 
+4
source

All Articles