I want to change the checkbox "outline" color, which is visible when focusing the checkbox in order to improve the visibility of the currently focused item when using the app with a keyboard or directional pad. How can I do that?
Image of what I mean: Focused CheckBox on Android
Edit: After finding the correct wording ("ripple color") for what I mean, I managed to change it with:
<item name="colorControlHighlight">#00f</item>
But this only applies to unchecked check boxes. Does anybody know how to apply it to all (also checked) checkboxes?
CodePudding user response:
You can check this blog: AppCompat themes
colorControlHighlight is for ripple color
So try to create a ThemeOverlay.AppCompat theme where you will set the value of the color that you want and that will allow you to change the ripple color for that view and its children.
To target ripple in theme use this attribute:
android:colorControlHighlight
CodePudding user response:
you can use the theme attribute:
app:theme="@style/MyCheckboxStyle"
then add this in your style.xml file :
<style name="MyCheckboxStyle" parent="AppTheme">
<item name="colorAccent">@color/colorAccent</item> // color when checkbox is checked
<item name="android:textColorSecondary">@color/colorSecondary</item> // when it is unchecked
</style>