Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter change splash screen background color

I have this default code in my launch_background.xml file:

<?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/ic_launcher" />
    </item>
</layer-list>

I would just like to know, how do I change this <item android:drawable="@android:color/white" /> to a custom colour, something like <item android:drawable="@android:color/#FFF8DC" />

like image 258
Paul Kruger Avatar asked Jun 13 '19 15:06

Paul Kruger


People also ask

How do I get rid of the white splash screen in flutter?

On the right in the properties, there is the background attribute. Clicking on this and choosing custom will allow you to define the RGB value you'd like the colour of the white screen to now appear as. Running your app on Android and iOS will now no longer show the annoying white screen.


1 Answers

Create a file android/app/src/main/res/values/colors.xml

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

Edit android/app/src/main/res/drawable/launch_background.xml

<?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="@color/red" />

    <!-- You can insert your own image assets here -->
    <!-- <item>
        <bitmap
            android:gravity="center"
            android:src="@mipmap/launch_image" />
    </item> -->
</layer-list>
like image 131
Luke Pighetti Avatar answered Sep 19 '22 20:09

Luke Pighetti