我似乎不能显示我自己的闪屏,每次我启动应用程序时,都会显示默认的空白闪屏,即使我已经在launch_background.xml中设置了所有的东西,在res中设置了其他文件.我还在drawablemipmap中设置了所有相关图标.

在后台启动.xml:

<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <color android:color="@color/splash" />
    </item>

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

style es.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
    <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <!-- Show a splash screen on the activity. Automatically removed when
             Flutter draws its first frame -->
        <item name="android:windowBackground">@drawable/launch_background</item>
    </style>
    <!-- Theme applied to the Android Window as soon as the process has started.
         This theme determines the color of the Android Window while your
         Flutter UI initializes, as well as behind your Flutter UI while its
         running.
         
         This Theme is only used starting with V2 of Flutter's Android embedding. -->
    <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <item name="android:windowBackground">?android:colorBackground</item>
    </style>
</resources>

colored颜色 .xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="ic_launcher_background">#191919</color>
    <color name="splash">#191919</color>
</resources>

AndroidManifest.xml中的<activity>标签:

<activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/LaunchTheme"
              />
            <!-- Displays an Android View that continues showing the launch screen
                 Drawable until Flutter paints its first frame, then this splash
                 screen fades out. A splash screen is useful to avoid any visual
                 gap between the end of Android's launch screen and the painting of
                 Flutter's first frame. -->
            <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

闪屏应该显示一个图像和不同的背景 colored颜色 ,但是它只显示默认的空白白屏.我不会为此使用自定义闪屏.我只想至少改变一下 colored颜色 ,但即使这样也不行.

推荐答案

还要在Drawable-v21/Launch_backround.xml中进行更改.这将用于Android API级别21或更高.

Flutter相关问答推荐

在Flutter中,CachedNetworks Image不工作(不从CachedData加载)

如何更新文本字段的基础上的选定下拉菜单?

build_runner显示错误没有为类ClassDeclaration定义getter宏关键字'

在创建肘部并使用冻结时,无法使用中的Copy With方法

Flutter 蜂窝单元测试

Firebase动态链接已弃用,不应在新项目中使用.Flutter 替代方案

BoxConstraints强制使用无限宽度(列中的Listview)

使小部件处于有状态状态会导致hasSize异常

如何使DropDownMenu宽度等于TextFormfield?

如何使 dart 函数变得通用?

如何更改Flutter 中文本的混合模式?

如何从Firebase登录获取用户信息,如电话号码、出生日期和性别

文本溢出文本框 - Flutter

Flutter url_launcher 插件抛出java.lang.IllegalArgumentException:接收器未注册:io.flutter.plugins.urllauncher.WebViewActivity

在 Flutter 中显示有关提供者通知的对话框

MediaQuery 在不同手机上不一致

Flutter 中父容器顶部的 Gridview 间距额外区域

我收到这个错误我无法解决

如何在Flutter 中制作自定义微调器?

在 Flutter 中更新对象实例属性的最佳实践是什么?该实例嵌套在提供程序类的映射中,如下所示