Questions tagged [android-night-mode]
92 questions
110
votes
11 answers
Android - How to detect if night mode is on when using AppCompatDelegate.MODE_NIGHT_AUTO
I'm using Androids built in day/night mode functionality and I'd like to add an option to my app for AppCompatDelegate.MODE_NIGHT_AUTO
I'm having a problem though because my app requires certain things to be colored programmatically, and I can't…

Ben987654
- 3,280
- 4
- 27
- 50
51
votes
7 answers
How to enable night mode programmatically?
I am looking for a way to enable night mode programmatically with an Android code:
public static void setNightMode(Context target, boolean state){
UiModeManager uiManager = (UiModeManager) target.getSystemService(Context.UI_MODE_SERVICE);
…

Ilan
- 729
- 3
- 8
- 17
38
votes
6 answers
Letting WebView on Android work with prefers-color-scheme: dark
I have an Android App that uses webview, and lately I'm trying to figure out how to add a dark theme by using the new @media (prefers-color-scheme: dark) CSS syntax. I have the correct CSS written on my page, and if I open it in Chrome with the…

Mu-Tsun Tsai
- 2,348
- 1
- 12
- 25
10
votes
2 answers
Android setting Nightmode changes resource language
This is an effect that is difficult to describe.
Our Android app supports two languages, however we don't use the system language but let the user set this in the settings.
Then, before attaching the BaseContext of the Application we set the locale…

Tobias Reich
- 4,952
- 3
- 47
- 90
10
votes
2 answers
Theme Color for Dark Mode in Android Chrome
In HTML you can define a theme color like this:
On mobile browsers like Android Chrome this will change the color of the adressbar. But when using dark mode, this value is simply ignored (at the time of…

jor
- 2,058
- 2
- 26
- 46
9
votes
0 answers
Android custom locale lost during Dark Mode (Night Mode) toggle
Our app requires us to be able to change the language based on user selection rather than just relying on the device locale.
This means we've had to implement a way for us to wrap the context when a user makes this selection and inject the…

HBG
- 1,731
- 2
- 23
- 35
7
votes
3 answers
Android - theme.xml and theme.xml(night)
In newer version of Android Studio
In values directory there is theme.xml and theme.xml(night)
Can any point out differences between them ??
Does it replace styles.xml ??

Prakash Niroula
- 121
- 2
- 6
7
votes
1 answer
How to implement night mode for splash screen?
I managed to add night mode for my app. It works for the whole app except Splash Screen. Splash screen use OS night mode settings. My application level changes not works for the splash screen. Is there any way to handle night mode in Splash Screen?…

Eren Tüfekçi
- 2,463
- 3
- 16
- 35
7
votes
1 answer
which android folder to resource of night mode, v21+? drawable-night-v21?
I know I can add resources for some Android versions + for night mode.
But what would be the name of the folder for night mode resources of API 21+ ?
drawable-night-v21?

Elad Benda
- 35,076
- 87
- 265
- 471
7
votes
1 answer
Android bug loading wrong colors in night mode
Disclaimer: I have already found a solution to this problem but wanted to post the question and answer for other people since it took me a long time to figure out why it was happening.
I ran into a strange issue where when opening my application in…

odiggity
- 1,496
- 16
- 29
6
votes
0 answers
AppCompatDelegate.setDefaultNightMode force closes app with no error
I am trying to add a night mode to my app but the app just closes each time it switches between day/night modes on my main screen. It just closes out the app, no error, no crash, no log cat data, just closes. Has anyone seen this happen before and…

Jayce
- 781
- 3
- 16
- 35
6
votes
3 answers
How to Change color of Dark action bar at night mode?
I treid to change the background color of the Action bar to another color istead of the default color.
I am using :
implementation 'com.google.android.material:material:1.2.0-alpha05'
... values/styles.xml: