我希望我的用户能够从一个黑暗与光明的主题切换为我的整个应用程序 [英] I want my users to be able to switch from a dark and light theme for my entire app

查看:179
本文介绍了我希望我的用户能够从一个黑暗与光明的主题切换为我的整个应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的黑暗与光明的风格设置。

I have my dark and light styles setup.

我希望用户能够从亮/暗主题在我的设置改变的活动。

I want the user to be able to change from light/dark theme in my settings activity.

我有弹出,让选择浅色或深色的对话框。

I have the dialog that pops up and lets choose light or dark.

我已阅读,这不能动态完成,并且罚款。我不介意应用程序重新启动更改申请。

I have read that this cannot be done dynamically and that fine. I dont mind the app restarting for changes to apply.

我见过的其他应用程序,如猎鹰亲,让这一点。我有它的设置就是这样。在猎鹰亲它问你是否想现在或以后重新启动应用程序。

I have seen other apps like falcon pro that allow this. i have it setup just like that. in falcon pro it asks if you want to restart app now or later.

推荐答案

活动有一个 setTheme 方法。你必须把它的任何活动,或更好的创建BaseActivity这确实是和继承您的任何活动由BaseActivity

Activity has a setTheme method. You have to call it at any activity, or better create a BaseActivity which does that and inherited any of your Activities by that BaseActivity

<一个href=\"http://stackoverflow.com/questions/4663752/switching-application-wide-theme-programmatically\">Switching应用程序范围内的主题编程?

这篇关于我希望我的用户能够从一个黑暗与光明的主题切换为我的整个应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆