在LaunchTheme和NormalTheme配置android原生资源没有视觉效果(白色屏幕)



问题:在android模块中更改/配置文件launch_background.xml对启动/启动屏幕没有任何影响,即启动时的白色屏幕将继续显示,直到flutter应用程序绘制出第一帧

我正在按照说明自定义启动屏幕;https://www.youtube.com/watch?v=JVpFNfnuOZM

但是,对<item android:drawable="@android:color/black" />的更改没有视觉效果。

没有显示的图像也是如此(见下文右侧(

<bitmap
android:gravity="center"
android:src="@mipmap/fist" />
</item>

注意,这是一个全新的项目,由安卓工作室中的flutter插件创建(详细信息如下(

非常感谢,

以下是开发环境:

颤振:

% flutter -v doctor
[✓] Flutter (Channel master, 2.9.0-1.0.pre.328, on macOS 11.6 20G165 darwin-x64, locale en-GB)
• Flutter version 2.9.0-1.0.pre.328 at /Users/jorge2antibes/dev/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision d290763941 (4 days ago), 2022-01-11 18:20:14 -0800
• Engine revision 643b2787f4
• Dart version 2.16.0 (build 2.16.0-159.0.dev)
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/jorge2antibes/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

清单:

<activity
android:name=".MainActivity"
android:exported="true"
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/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

项目的构建.gradle:

buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

gradle-wrapper特性:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-7.0.2-all.zip

我维护了一个软件包flatter_native_splash,它将自动为您创建启动屏幕,并更改您看到的默认白色屏幕。

最新更新