2013-07-31 84 views
0

在Android中,我有一个首选项屏幕(请参阅第一个屏幕快照)。用户点击“选择球”并显示子屏幕(见第二个屏幕截图)。但是,第一个屏幕仍然显示在第二个屏幕的下方,例如当显示子屏幕时,您可以看到“选择球”。我如何防止这种情况?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> 

First screen

Second screen

+0

什么是您使用的窗口背景活动?它是透明的吗? – Karakuri

+0

根据您的意见,我一直在寻找这样的参数。我试过 'android:windowIsTranslucent =“false”' 'android:windowBackground =“@ color/orange”' (其中orange在res/values/strings.xml中定义),但没有效果。我也尝试了一个主题,正如这里所建议的,但没有效果: http://stackoverflow.com/questions/3551169/change-background-color-of-preference 但也没有效果。 –

+0

如果我在LiveWallpaperSetting.java中执行此操作: 'ListView listView = this.getListView();' 'listView.setBackgroundColor(Color.BLUE);' 然后顶层首选项屏幕的背景颜色是蓝色且不透明的,但这对子屏幕没有影响。 –

回答

0

对我来说,解决办法是设置主题在manifest.xml文件的活动:

<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>`