Ten Digit Grid
Ten Digit Grid

Reputation: 2629

Flutter Android Splash Screen always black

Oddly enough my android apps splash screen is white on my android emulator but black on my personal phone when I load the APK on it.

When I went to investigate I see this in the Android manifest:

    <meta-data
        android:name="io.flutter.embedding.android.NormalTheme"
        android:resource="@style/NormalTheme"
    />

And when I go to res drawable I see a file called launch_background.xml which sounds promising.

But when I look inside it, it shows:

<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@android:color/white" />

    <!-- You can insert your own image assets here -->
    <!-- <item>
        <bitmap
            android:gravity="center"
            android:src="@mipmap/launch_image" />
    </item> -->
</layer-list>

Which is odd because it says its white. So I am not sure what I am missing on why my cell phone boots it black. I want to make the splash screen background color white for everyone.

Upvotes: 3

Views: 2531

Answers (4)

Hassan Gujjar
Hassan Gujjar

Reputation: 326

create a new file named color.xml in values in given route => your_project_name\android\app\src\main\res\values and add this code.

<?xml version="1.0" encoding="utf-8"?>
    <resources>
        <color name="background_color">#ffffff</color>
    </resources>

after that use this line in both drwables under layer-list tag

<item android:drawable="@color/background_color" />

this will solve your issue

Upvotes: 2

Abhiram
Abhiram

Reputation: 175

If your Emulator shows a white screen and your phone shows dark maybe it's because of the dark theme on your mobile phone

in your phone settings change the dark mode to Light mode

settings -> display -> Lightmode

if your phone has a dark theme all the white colors will appear as black hope it helps

Upvotes: 1

Karolina Hageg&#229;rd
Karolina Hageg&#229;rd

Reputation: 1387

Are you using a dark theme on your phone? Like, do your Messenger app, email app etc have a dark background?

And if so, if you change that to a light theme, does that give your splash screen a white background?

(I was thinking since your Android manifest talks about "normal theme"... That's gotta be the overall theme of the phone, right? Perhaps remove that from the manifest?)

Also, if you follow this method to set your splash screen, including background color, does it help?:

https://youtu.be/JVpFNfnuOZM

Upvotes: 0

Tayfun Kaya
Tayfun Kaya

Reputation: 1

maybe you can add a white image ;

Android/App/res/drawable/white.png

<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@android:color/white" />

    
    <item>
        <bitmap
            android:gravity="center"
            android:src="@drawable/white" />
    </item>
</layer-list>

Upvotes: 0

Related Questions