I’m trying to style some checkboxes (the box itself, not the label) to have a set color when checked vs unchecked.
To facilitate this, I created the following theme:
<style name="checkBoxStyle" parent="Base.Theme.AppCompat">
<item name="colorAccent">#FFFF</item>
<item name="android:textColorSecondary">#FF598392</item>
<item name="android:textColor">#FFFF</item>
<item name="android:layout_height">wrap_content</item>
</style>
From there, I implemented the theme in my activity layout:
...
<CheckBox
android:theme="@style/checkBoxStyle"
android:id="@+id/search_ingredients_checkbox"
android:text="@string/search_ingredients" />
<CheckBox
android:theme="@style/checkBoxStyle"
android:id="@+id/search_directions_checkbox"
android:text="@string/search_directions" />
...
So far, everything works as expected. However, once I try to click the checkbox in my emulator, the checkbox color is set to black, and the the uncheck box is also that same black.
I have not added any listeners to the checkboxes, so it’s nothing I’m doing as far as I can tell.
I’ve attempted a clean/rebuild of the project, and a new emulator setup. Unfortunately, the behavior persists.
Gradle: com.android.tools.build:gradle:8.3.2
targetSdk: 34
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.12.0'