I'm trying to style a ListPreference Dialog to suit a dark theme, with the accent color given by my code. However, the text color for each option does not seem to change no matter what attribute I add to it. Is there a way to do this without having to create my own Dialog class? P.s. I have tried the solution given in this answer: ListPreference text color And no, it does not seem to work. Here's the required code from styles.xml: (Not the entire code but it's all I need to show)
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="dialogPreferenceStyle">@style/DialogBoxTheme</item>
<item name="listDividerAlertDialog">@style/DialogBoxTheme</item>
<item name="alertDialogStyle">@style/DialogBoxTheme</item>
<item name="alertDialogTheme">@style/DialogBoxTheme</item>
</style>
<style name="DialogBoxTheme" parent="ThemeOverlay.AppCompat.Dialog.Alert">
<item name="android:layout_centerHorizontal">true</item>
<item name="android:layout_centerVertical">true</item>
<item name="android:layout_gravity">center</item>
<item name="android:layout_width">320dp</item>
<item name="android:layout_height">200dp</item>
<item name="android:layout_marginStart">16dp</item>
<item name="android:layout_marginEnd">16dp</item>
<item name="android:textColorPrimary">@color/colorPrimary</item>
<item name="android:textColorSecondary">@color/colorPrimary</item>
<item name="android:textColorHint">@color/Silver</item>
<item name="android:textColorTertiary">@color/colorAccent</item>
<item name="android:textColor">@color/colorPrimary</item>
<item name="android:colorAccent">@color/colorAccent</item>
<item name="android:background">@color/cpWhite</item>
<item name="textColorAlertDialogListItem">@color/colorPrimary</item>
<item name="android:textColorAlertDialogListItem">@color/colorPrimary</item>
</style>
(note that I've set colorPrimary and colorAccent to vary with the theme)
Here's the output that it gives: ListPreference Dialog appearance
Answering my own question: I forgot to add the attribute
<item name="android:alertDialogTheme">@style/DialogBoxTheme</item>
to the AppTheme in styles.xml.