Nested preference screens lose theming
Asked Answered
S

2

8

I have a preference screen for my application and in the manifest I have given it a theme using:

android:theme="@android:style/Theme.Light.WallpaperSettings"

However when I nest another preference screen inside this one such as:

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    android:title="@string/setting_title"
    android:key="...">

    <PreferenceCategory
    android:title="@string/title_themes"
    >

    <PreferenceScreen
    android:title="@string/title_themes_opt"
    >

        <ListPreference
    android:key="Setting_BG"
    android:title="@string/setting_bg"
    android:summary="@string/setting_bg_summary"
    android:entries="@array/bg_titles"
    android:defaultValue="0"
    android:entryValues="@array/bg_values" />
    </PreferenceScreen>

    </PreferenceCategory>

</PreferenceScreen>

The nested preference screen loses the theme of the parent. How can this be prevented? Thanks in advance.

Sequestered answered 2/5, 2010 at 21:11 Comment(0)
S
6

This is a bug in android see the Bug Report.

Sequestered answered 17/8, 2010 at 17:15 Comment(0)
S
2

Just ran into this problem.

While the suggestion in the bug report is to create your own custom style and set the listview background, we found it easier to create a separate activity for each preference screen. This allowed us to set the Theme.Light to each screen with no issue.

Not a great fix, but it works.

Saccharometer answered 29/9, 2010 at 22:23 Comment(2)
How do I go about loading in a separate activity for each preference screen? Can you point me to an example?Oldie
I'm guessing I have to use addPreferenceFromIntent() Trying to figure out how to do that now.Oldie

© 2022 - 2024 — McMap. All rights reserved.