2

I am trying to add Text the bottom of the android default splash screen launch icon in the launch_background.xml located in Flutter App>\android\app\src\main\res\drawable

<?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>

so far i just tried adding a label tag below the item tag, it didn't work.

JideGuru
  • 7,102
  • 6
  • 26
  • 48
Gabe
  • 136
  • 2
  • 11

2 Answers2

0

A layer-list as used in your drawable, is a way to layer multiple drawables on top of each other. You can not add plain text to the image, but you could define a new drawable which is the text, then add the layer to your list.

Another option is this:

Open Paint or any image editing tool, write your text and save the file as png image

Import png file in drawables and add it in <layer-list> as an item below or above your logo/icon

<item android:bottom="50dp"> set position as you want

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:opacity="opaque">
    <item android:drawable="@color/colorPrimary"/>
    <item>
        <bitmap
            android:gravity="center"
            android:src="@drawable/icon"/>
    </item>
    <item android:bottom="50dp">
        <bitmap
            android:gravity="center"
            android:src="@drawable/myTextImage"/>
    </item>
</layer-list>
MαπμQμαπkγVπ.0
  • 5,887
  • 1
  • 27
  • 65
0

It's not possible to add Text on the splash screen. A workaround here is to add the text on the image that's being used on the splash screen.

To add new colors that can be used on the splash screen, create colors.xml in /android/app/src/main/res/values/colors.xml

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

You can now use the color by adding this on launch_background.xml

<item>
  <color android:color="@color/color_name">
</item>
Omatt
  • 8,564
  • 2
  • 42
  • 144