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 ??
Android - theme.xml and theme.xml(night)
8.2k views Asked by Prakash Niroula AtThere are 3 answers
he DayNight theme and the resources used with the -night qualifier were introduced with the Support Library 23.2 in the 2016 Dark Theme has been introduced for devices where users can change the theme configuration of their android device.
Theme.xml file : This file will be used by default in your app.
Theme.xml file (night) : This file all the attributes will be used automatically when the user has enabled Dark Theme in their android device.
Does it replace styles.xml ?? : You will have to set different styles as well so that your UI views are properly visible to the user w.r.t. color schemes.
In values directory there is theme.xml and theme.xml(night)
There are 2 folders res\values
and res\values-night
and in each folder there is the theme.xml
file.
The -night
is a qualifier to define the resources (styles,dimens..) used in the Dark(night) Theme.
As specified in the latest Android Studio 4.1 features :
Actually, in the older versions of Android studio, if you want to enable dark mode in your app, you have to manually create and define the properties in your dark theme XML file, but now it is automatically generated as mostly all new apps are moving towards dark mode in their applications.
You can still delete these files from your Android studio project if it doesn't fit in your use-case.