In res/values/colors
There are two colors colors.xml colors.xml(night)
If night does not exist, you can make it as follows:
Right click on the values folder.
Next New. Then Values Resource file
Enter the colors in the file name field
And enter the values-night in the directory name field.
In colors.xml, select the colors that are for the light, such as:
Your themes and styles should avoid hard-coded colors or icons intended for use under a light theme. You should use theme attributes (preferred) or night-qualified resources instead.
2
Answers
In
res/values/colors
There are two colors
colors.xml
colors.xml(night)
If night does not exist, you can make it as follows:
Right click on the
values
folder.Next
New
. ThenValues Resource file
Enter the
colors
in thefile name
fieldAnd enter the
values-night
in thedirectory name
field.In colors.xml, select the colors that are for the light, such as:
In colors.xml(night), set the colors for the night(Same name as colors):
Now if in layout, for example:
It is selected according to what you put in the light and night colors.
https://developer.android.com/guide/topics/resources/providing-resources
Use the folders:
It mentions it here as well: https://developer.android.com/guide/topics/ui/look-and-feel/darktheme#config-changes
"night-qualified resources"