With the new PreferenceFragmentCompat from the v7 Preference Support Library: http://developer.android.com/tools/support-library/features.html#v7-preference, I get this error
E java.lang.IllegalStateException: Must specify preferenceTheme in theme
E at android.support.v7.preference.PreferenceFragmentCompat.onCreate(PreferenceFragmentCompat.java:202)
What theme should be set?
Update: I have tried using
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
as suggested by @Bogato but it doesn't look right and looks very Holo even on Lollipop.
Support library:
Native preferences:
Now one can use the library pretty easy. Here are quickest way to do so, but you should check out the README for more info.
compile 'com.takisoft.fix:preference-v7:27.0.0.0'
You can use either PreferenceFragmentCompat
or PreferenceFragmentCompatDividers
.
(Watch out for the appropriate package name when importing PreferenceFragmentCompat
!)
Set your containing Activity's theme to a variant of @style/PreferenceFixTheme
, like NoActionBar, Light, etc.
For more info and usage tips, go to the project's page.
P.S. In this section you could find the detailed solution that led to creation of the library, but I decided to remove it because it might be confusing. If you're curious about the steps, you can still find them in the revision history of this answer.