I would like to change color of the text when CheckBox is checked. This is what I have for now:
<CheckBox android:id="@+id/checkbox" android:layout_width="20dp" android:layout_height="20dp" android:background="@drawable/states" android:gravity="center_horizontal|center_vertical" android:button="@null" android:text="test/> Checkbox background is normally changed when checkbox is checked. The problem is text. It's always the same color. How can I also change text color when checkbox is checked?
This is how I change states for checkbox background (I removed extras because of simplicity):
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="false"> <layer-list > <item> <shape android:shape="oval"> </shape> </item> </layer-list> </item> <item android:state_checked="true" > <layer-list > <item> <shape android:shape="oval"> </shape> </item> </layer-list > </item> </selector>