Flutter的启动画面android超过一张图片

时间:2019-03-08 06:40:36

标签: android flutter splash-screen

嘿,我的应用程序具有抖动功能,我使用此代码及其全部功能在Android上实现了启动画面。

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>

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

但是,如果我再添加一张图像,它可以工作,但是在splashscreen之后,该应用程序将强制关闭,并且不会在flutter控制台中出现错误。所以代码看起来像这样 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>

如何修复或使其正常工作? 谢谢

0 个答案:

没有答案