'How to use only light mode in aplication? Android Studio
I'm developing a program, but as I have the mobile phone in the dark theme, some textViews have a white letter and don't appear due to the color that is placed on them.
But when I switch the phone to the lightweight theme, the textView all appear.
I would like to know if it is possible to disable the dark theme in Android Studio and only use the light theme, even when the phone is set to a dark theme.
Solution 1:[1]
Just put this line in the launcher activity before setContentView()
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
Solution 2:[2]
In your themes.xml
your application theme's parent should be Theme.MaterialComponents.Light.NoActionBar
, or if you wan't to use the action bar (you shouldn't), then Theme.MaterialComponents.Light.DarkActionBar
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ali Nawaz |
Solution 2 | A. Patrik |