我的偏好活动完全是黑色的

时间:2016-07-24 12:45:26

标签: java android preferenceactivity preference

我正在尝试使用preferenceActivity进行设置屏幕,但它不起作用,当我点击菜单上的“设置”时,它会给我黑色偏好屏幕:/

PreferenceActivity ScreenShot

preferences_activity.xml

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent">

 <PreferenceCategory
     android:title="Zamanlayıcı"
     android:key="Countdowntimer_key">

     <CheckBoxPreference
         android:key="countdowntimer_loop_pKey"
         android:summary="Süre bittikten sonra yeniden otomatik başlat"
         android:title="Zamanlayıcı Döngüsü"
         android:defaultValue="false"
         />

 </PreferenceCategory>




</PreferenceScreen>

PreferenceActivity.Java

   public class PreferenceActivity extends android.preference.PreferenceActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTheme(R.style.ZaaTheme);
        addPreferencesFromResource(R.xml.preferences_activity);


    }
}

1 个答案:

答案 0 :(得分:0)

我在某些设备上遇到同样的问题。在清单中设置主题对我有帮助,例如    android:theme="@style/Theme.AppCompat.DayNight"