I have a preferenceActivity in my application and I have tried to set the preference style using the following theme:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyPreferenceTheme" parent="android:Theme.Translucent">
<item name="android:preferenceStyle">@style/MyPreference</item>
<item name="android:windowBackground">@color/transparent_black</item>
</style>
<style name="MyPreference" parent="@android:style/Preference">
<item name="android:layout">@layout/preference</item>
</style>
<color name="transparent_black">#BB000000</color>
So I know that the theme is loading as the background is colored correctly. However my custom preferenceLayout (res/layout/preference.xml) is not getting applied to any of the preferences inside my preferenceActivity.
Is this the correct way to achieve theming of the preferences? or have I missed something? Thanks in advance :)
I found that it's best not to use parent="android:style/Preference" as it doesn't seem to apply the style I'm trying to override it with. Style your layout that you're using (@layout/preference) and drop the inheritance from the android:style/Preference. It worked for me when I had to do the same.
so it should be:
Good luck!