Day-Night Theme using Switch in Android

Android allows us to override resources specific to Day or Night themes. You can do this using the –night resource qualifier, appended to our resource folder names.

For instance, I want to change my colors for the night theme. I can do so by creating a new resource, specific for that: res/values/style.xml And color.xml Then I can simply override the colors for them here. But for the sake of depth, let’s see how we can override the Night Theme itself.


It’s simple to use, just change your theme to extend from one of the DayNight variants, and then there’s one call to enable it. So here’s your new theme declaration.





Output :-

Day-Night Theme

About Jaimin Patel

I am a Web Developer. I have been blogging and researching since 1 years and like to share my knowledge and research with the world. Peace..!!

View all posts by Jaimin Patel →

Leave a Reply

Your email address will not be published. Required fields are marked *