Closed thearaks closed 7 years ago
First of all, you don't need these lines in your build.gradle as the fix already links them:
compile "com.android.support:preference-v7:25.3.1"
compile 'com.android.support:preference-v14:25.3.1'
Secondly, the styling doesn't look good to me. PreferenceFixTheme
contains the preferenceTheme
attribute itself because it is meant to be used as the "root" style, not the "preferenceTheme" style. Try the following solution instead (removed the preferenceTheme
attribute and changed the parent theme to the fixed theme of your AppTheme
):
<style name="AppTheme" parent="@style/PreferenceFixTheme.Light.DarkActionBar">
<item name="colorPrimary">@color/colorBlue</item>
<item name="colorPrimaryDark">@color/colorBlueDark</item>
<item name="colorAccent">@color/colorOrange</item>
</style>
Thank you very much @Gericop. It obviously works now!
README.md wasn't very clear about this point (at least for me, maybe because I'm not a native speaker). A quick example of an AppTheme that extends PreferenceFixTheme might help, what do you think about it?
Well, the sample app is supposed to show the basic usage, but I guess it won't hurt if I add an extra few lines to the README file.
build.gradle:
theme.xml:
And this is the preference XML:
This immediately leads to a crash:
This happens on both Android 4.4.2 and 7.1.2.
It looks like not all the widget were inflated (i.e. R.id.seekbar and _R.id.seekbarvalue) or that the wrong layout was inflated.
Or, maybe... have I misconfigured something?