How to implement night mode for splash screen?

878 Views Asked by At

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

1

There are 1 best solutions below

0
On

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.