I want my users to be able to switch from a dark and light theme for my entire app [duplicate]

此生再无相见时 提交于 2019-12-25 07:42:16

问题


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.


回答1:


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

Switching application-wide theme programmatically?



来源:https://stackoverflow.com/questions/15581221/i-want-my-users-to-be-able-to-switch-from-a-dark-and-light-theme-for-my-entire-a

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!