7

I managed to add night mode for my app. It works for the whole app except Splash Screen. Splash screen use OS night mode settings. My application level changes not works for the splash screen. Is there any way to handle night mode in Splash Screen?

Style:

<style name="SplashScreenTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">

    <item name="android:background">@drawable/logo</item>
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>

</style>

@drawable/logo:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <color android:color="@color/compatible_night"/>
    </item>
    <item>
        <bitmap
            android:src="@drawable/grs"
            android:tileMode="disabled"
            android:gravity="center"
            />
    </item>
</layer-list>

colors.xml(night)

<color name="compatible_night">#121212</color>

colors.xml

<color name="compatible_night">#FFFFFF</color>

I tried to use style in night folder, colors in night folder and layer list in night folder, nothing worked

Eren Tüfekçi
  • 2,463
  • 3
  • 16
  • 35
  • Hey, did you figure out how to make it work? Am facing similar issue – saintjab Apr 02 '20 at 11:39
  • 2
    Unfortunately. Splash screen only follows the system settings. – Eren Tüfekçi Apr 02 '20 at 12:11
  • 1
    Hi, I use a different way to change the splash screen color to night mode, everything works for me good, but the problem is, when you start the app, the splash screen has the day color for a moment and then changes to the night one. So for could not find out why it so happens. – Mark Delphi Jul 18 '20 at 21:59
  • @MarkDelphi you able to find a solution? – Farzad Jul 04 '21 at 02:29
  • @Farzad So, actually I defined a separate theme for splash screen and thus, it does not follow the system style theme when the app starts. This worked for me. – Mark Delphi Jul 06 '21 at 11:35
  • @MarkDelphi Unfortunately, the Android theme system is very poorly designed. The color of the Android theme system cannot be changed at the beginning of the app. – Farzad Jul 07 '21 at 13:08

1 Answers1

1

To not waste your time Splash screen in Android follows the default system theme not the app theme. So the only way to apply night mode on splash screen is to turn the dark mode on in the phone settings or else the splash screen will be displayed in light mode.

Michael
  • 411
  • 2
  • 6
  • 15