Search code examples
android-studioandroid-layoutandroid-theme

Delete the night mode in my android application | android studio


I do not want the night mode in my application, I tried to delete a file themes.xml (night), But that didn't work, I also tried moving the themes.xml file content to a themes.xml (night) And it didn't work either.

themes.xml file

<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style> 

Can you help me thanks!.


Solution

  • Please use default app theme in style file instead of "Theme.AppCompat.DayNight.NoActionBar". Night mode will not work unless we use the Day Night theme in style. There for you can use default theme for your application to disable the dark mode.

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    </style>