Theming ListPreference Dialogs on Android Lollipop

ListPreferenceSetting a custom theme color for your Android app is as simple as setting a colorAccent color in the app’s styles.xml file. Yet while this will theme most of the app, oddly ListPreference pop-ups and other dialogs do not naturally inherit the theme used by the rest of the app.

In order to fix this both a dialogTheme and an alertDialogTheme need to be explicitly added to the app’s styles.xml file. The result should look similar to this…

<?xml version="1.0" encoding="utf-8"?>
    <style name="AppTheme" parent="android:Theme.Material.Light">
        <item name="android:colorPrimary">@color/primary
        <item name="android:colorPrimaryDark">@color/accent
        <item name="android:colorAccent">@color/accent
        <item name="android:dialogTheme">@style/DialogStyle
        <item name="android:alertDialogTheme">@style/DialogStyle
    <style name="DialogStyle" parent="android:Theme.Material.Light.Dialog">
        <item name="android:colorAccent">@color/accent