DVT
DVT

Reputation: 165

Change ListPreference's colors to match theme style

I'm using a ListPreference in my settings and I want the colors to adapt to the ones of the current theme. Currently I am changing the theme's alertDialogTheme style to my own. I have figured out how to change the dialog title's color, dialog button's colors, the radio button's text and the radio button's color of the currently selected item. I want to change the color of the unselected items' radio button. I circled in red the colors that I want to change.

ListPreference:

Dark themed Light themed

Theme style:

<style name="Theme" parent="Theme.MaterialComponents.DayNight">
    <item name="alertDialogTheme">@style/NoteCreation.Dialog</item>
</style>

<style name="NoteCreation.Dialog" parent="Theme.MaterialComponents.Dialog.MinWidth">
    <item name="colorAccent">@color/colorPrimaryDark</item>
    <item name="textColorAlertDialogListItem">@color/onSurface</item>
    <item name="android:textColor">@color/onSurface</item>
    <item name="android:background">@color/surface</item>
    <item name="buttonBarNegativeButtonStyle">@style/NoteCreation.Dialog.Button</item>
    <item name="buttonBarPositiveButtonStyle">@style/NoteCreation.Dialog.Button</item>
</style>

<style name="NoteCreation.Dialog.Button" parent="Widget.MaterialComponents.Button.TextButton.Dialog">
    <item name="android:textColor">@color/colorPrimary</item>
</style>

Upvotes: 2

Views: 191

Answers (1)

DVT
DVT

Reputation: 165

Changing the android:textColorSecondary attribute of the NoteCreation.Dialog did it.

Upvotes: 2

Related Questions