I have a button that enables/disables a checkbox but I cannot see the disabled checkbox due to the color it turns (my style background color must be the same color as the disabled checkbox). How do I change the color of a disabled checkbox and also ensure that the color returns to an "enabled" color when the checkbox becomes enabled again?
This is what I mean:
The checkbox in question is simple:
<CheckBox
android:id="@+id/settings_hide_nsfw_thumbnails"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
Easiest to define a new style and apply it to the checkbox in xml.
<style name="MyCheckBox" parent="Theme.AppCompat.Light">
<item name="colorControlNormal">@color/notactive</item>
<item name="colorControlActivated">@color/active</item>
</style>
apply it with android:theme="@style/MyCheckBox"
normal= not selected
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With