【发布时间】:2013-08-01 09:12:48
【问题描述】:
在 Android 中,我有一个偏好设置屏幕(参见第一个屏幕截图)。用户点击“选择球”并显示子屏幕(见第二个屏幕截图)。但是,第一个屏幕仍显示在第二个屏幕下方,例如当显示子屏幕时,您可以看到“选择球”。如何防止这种情况发生?
<?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>
【问题讨论】:
-
您用于活动的窗口背景是什么?它完全透明吗?
-
根据你的cmets,我一直在寻找这样的参数。我尝试了
android:windowIsTranslucent="false"android:windowBackground="@color/orange"(其中橙色在 res/values/strings.xml 中定义),但没有效果。我也尝试了一个主题,按照这里的建议,但没有效果:stackoverflow.com/questions/3551169/… 但也没有效果。 -
如果我在 LiveWallpaperSetting.java 中这样做:
ListView listView = this.getListView();listView.setBackgroundColor(Color.BLUE);那么顶层首选项屏幕的背景颜色是蓝色和不透明的,但这对子屏幕没有影响。 -
我的答案是在项目 manifest.xml 文件中设置主题
标签: android preferences