Android - theme.xml and theme.xml(night)

8.2k views Asked by At

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 ??

3

There are 3 answers

1
Ankit Gupta On BEST ANSWER

As specified in the latest Android Studio 4.1 features :

Every new project will be having two theme xml files : one for light and other one for dark mode.

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.

1
Prajwal Waingankar On

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.

0
Gabriele Mariotti On

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.