问题
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