Android Q introduced a setting to force dark mode on apps without worrying about changing the colors manually: https://developer.android.com/preview/features/darktheme#force_dark
This works fine even for my app which uses a WebView! However, I would like to give users the choice to enable dark mode whenever they need it. Is it possible to leverage the automatic changes done by "android:forceDarkAllowed" for that purpose?
You can programmatically enable the dark theme on Android Q with the following code:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With