Android - System doesn't recognize my theme as dark mode

498 views Asked by At

I have two themes. One is:

<style name="ThemeDay" parent="Theme.AppCompat.Light.NoActionBar">

Other one is:

<style name="ThemeNight" parent="Theme.AppCompat.DayNight.NoActionBar">

I apply themes in every activity like this before super.onCreate()

if(GenelUtil.getNightMode()){
    setTheme(R.style.ThemeNight);
}else{
    setTheme(R.style.ThemeDay);
}

Theme is applied. But system doesnt behave like selected theme.

For example when system is light mode and app is dark mode, Navigation bar is still white, dialogs are still white etc..

But when I open instagram and switch to dark mode, system also behave like its in dark mode.

What do I do wrong here? How can I fix this?

1

There are 1 answers

4
snachmsm On BEST ANSWER

DayNight theme is picking automatically dark or light params/colors basing on system settings (by default) or set/forced by you (e.g. using AppCompatDelegate.setDefaultNightMode())

when you have light theme in your system and you will use DayNight theme for your app then still not overriden colors will be same as in "light" theme