PreferenceActivity主题背景不变

时间:2013-09-19 14:19:14

标签: java android android-preferences

我的应用程序具有基于用户从设置菜单中选择的明暗主题之间的功能。除设置菜单外,此工作正常。在黑暗的主题上它只更改文本而不是背景和操作栏。我添加了一张黑屏看起来像的图片。为什么要这样做?

编辑:主题更改的代码。主题在创建开始时调用。

public static void theme(Activity activity) {
        if (userChoice==true)activity.setTheme(R.style.HoloDark);
        else if (userChoice==false)activity.setTheme(R.style.HoloLight);
    }

public void loadPreferences() {
        SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
        boolean test = settings.getBoolean("nightmode", false);
        settings.registerOnSharedPreferenceChangeListener(MainActivity.this);
        if (test == true)userChoice=true;
        else if (test == false)userChoice=false;        
    }

Settings Menu

0 个答案:

没有答案
相关问题