0

In Android, I have a screen for preferences (see first screen shot). The user clicks on "Choose Balls" and the sub screen is displayed (see 2nd screen shot). However, the first screen is still displayed underneath the 2nd screen, e.g. you can see "Choose Balls" when the subscreen is displayed. How do I prevent this?

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

    <PreferenceScreen
        android:key="ball_color_category_key"
        android:persistent="false"
        android:title="@string/ballcolor" >

        <PreferenceCategory android:title="@string/livewallpaper_settings" >
            <CheckBoxPreference
                android:defaultValue="true"
                android:key="redball"
                android:summary="Display red ball."
                android:title="Display red ball" />
            <CheckBoxPreference
                android:defaultValue="true"
                android:key="greenball"
                android:summary="Display green ball."
                android:title="Display green ball" />
            <CheckBoxPreference
                android:defaultValue="true"
                android:key="blueball"
                android:summary="Display blue ball."
                android:title="Display blue ball" />
            <CheckBoxPreference
                android:defaultValue="true"
                android:key="yellowball"
                android:summary="Display yellow ball."
                android:title="Display yellow ball" />
            <CheckBoxPreference
                android:defaultValue="true"
                android:key="purpleball"
                android:summary="Display purple ball."
                android:title="Display purple ball" />
        </PreferenceCategory>
    </PreferenceScreen>

    <PreferenceCategory android:title="@string/livewallpaper_settings" >
        <Preference
            android:key="facebook"
            android:summary="@string/facebook"
            android:title="@string/facebook" />
    </PreferenceCategory>

</PreferenceScreen>

First screen

Second screen

Al Lelopath
  • 6,448
  • 13
  • 82
  • 139
  • What is the window background you use for the activity? Is it transparent at all? – Karakuri Jul 31 '13 at 17:52
  • Based on your comments, I've been searching for such parameter. I tried `android:windowIsTranslucent="false" ` `android:windowBackground="@color/orange"` (where orange is defined in res/values/strings.xml), but no effect. I also tried a theme, as suggested here, but no effect: http://stackoverflow.com/questions/3551169/change-background-color-of-preference but also no effect. – Al Lelopath Jul 31 '13 at 21:15
  • If I do this in LiveWallpaperSetting.java: `ListView listView = this.getListView();` `listView.setBackgroundColor(Color.BLUE);` Then the background color of top layer preferences screen is blue and opaque, but this has no effect on the subscreen. – Al Lelopath Jul 31 '13 at 21:15
  • The answer for me was to set the theme in the project manifest.xml file – Al Lelopath Aug 05 '13 at 15:31

1 Answers1

0

The solution for me was to set the theme in the Activity in the manifest.xml file:

<activity android:label="@string/livewallpaper_settings"  
    android:name="com.developername.LiveWallpaperSettings"
    android:exported="true"
    android:icon="@drawable/ic_launcher"
    android:theme="@android:style/Theme.Black">
</activity>`
Al Lelopath
  • 6,448
  • 13
  • 82
  • 139
  • This doesn't solve the issue if I actually want to use a transparent background. Now the sub screen don't necessarily need to be transparent, but the preferable behavior is that the main preference screen's visibility is disabled... However, to disable transparent background altogether is not an acceptable solution from my point of view. – MahNas92 Mar 14 '18 at 15:44