Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问之前的页面如何改变theme呢? #13

Open
wshx21 opened this issue May 25, 2017 · 2 comments
Open

请问之前的页面如何改变theme呢? #13

wshx21 opened this issue May 25, 2017 · 2 comments

Comments

@wshx21
Copy link

wshx21 commented May 25, 2017

No description provided.

@wshx21
Copy link
Author

wshx21 commented May 25, 2017

已经解决,利用生命周期动态改变一下

@feng612266
Copy link

/**
 * 历史Activity换肤(夜间模式切换)
 */
public void changeHistoryActivityMode() {
    if(null != activityStack) {
        for (Activity activity : activityStack) {
            if (activity != null) {
                if (SharedPreferencesMgr.getInt("theme", 0) == 1) {
                    activity.setTheme(R.style.theme_2);
                } else {
                    activity.setTheme(R.style.theme_1);
                };
                activity.recreate();
            }
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants