Theming DialogPreferences
I'm using a theme to customize the look and feel of a settings dialog. The
preferences are defined in XML and inflated by a PreferenceFragment. The
way of attaching the fragment is basically as described in the developer
guide.
It works totally fine customizing the first screen via a custom theme
applied to the hosting activity:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(R.style.Theme_Preferences_Dialog);
...
With the style:
<style name="Theme.Preferences.Dialog"
parent="@android:style/Theme.Holo.Light.Dialog">
<item name="android:colorBackground">#fff0f0f0</item>
<item name="android:background">#fff0f0f0</item>
<item name="android:divider">#ffe0e0e0</item>
<item name="android:textColorPrimary">#ff555555</item>
<item name="android:textColorSecondary">#ff808080</item>
<item
name="android:textAppearanceLarge">@style/preferences_large_text</item>
<item
name="android:textAppearanceMedium">@style/preferences_medium_text</item>
</style>
The trouble is that all preferences that are opening up a dialog (like a
ListPreference), have a different style than the rest of the dialog and
having a non transparent region around the dialog:
No comments:
Post a Comment