RIFAL
RIFAL

Reputation: 3637

Flutter splash screen android more than one image

hei, i have app build with flutter, i implement splashscreen on android with this code and its fully work.

style.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
        <!-- Show a splash screen on the activity. Automatically removed when
             Flutter draws its first frame -->
        <item name="android:windowBackground">@drawable/launch_background</item>
        <item name="android:windowFullscreen">true</item>
    </style>
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>
</resources>

and the launch_background.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@color/company" />
    <item>
        <bitmap
            android:gravity="fill_horizontal|fill_vertical"
            android:src="@drawable/screen" />
    </item>
</layer-list>

but if i add one more image,its work but, after splasscreen the app force close without error notif in flutter console. so the code look like this launch_background.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@color/company" />
    <item>
        <bitmap
        android:gravity="fill_horizontal|fill_vertical"
        android:src="@drawable/screen" />
</item>
<item>
    <bitmap
        android:gravity="center"
        android:src="@drawable/company_icon" />
</item>

how to fix or make it work? thanks

Upvotes: 1

Views: 1879

Answers (1)

Omatt
Omatt

Reputation: 10483

Native Android splash screen doesn't seem to have support for multiple images. As mentioned in the docs, the customizable elements are the app icon, icon background, and window background. As a workaround, you can create your own splash screen with Widgets.

Upvotes: 1

Related Questions