I am trying to figure out why I am getting this error:
java.lang.IllegalStateException: Must specify preferenceTheme in theme
at android.support.v7.preferenc
Thanks to the solution that @Panther suggested. All I had to do is to add this line <item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
to my Application Theme and not just the theme of the individual activity that is showing my PreferenceFragment like that:
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
</style>
Alternatively you can use
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
to achieve modern material look.