Flutter应用在启动时会存在一个过渡背景色,
修改以下四个文件:
1、android/app/src/main/AndroidManifest.xml
文件中,<application
添加一行:
android:theme="@style/LaunchTheme"
2、android/app/src/main/res/values/styles.xml
文件中,修改<item>
:
<item name="android:windowBackground">@null</item>
3、android/app/src/main/res/values-night/styles.xml
文件中,修改<item>
:
<item name="android:windowBackground">@null</item>
4、android/app/src/debug/AndroidManifest.xml
文件中,将内容替换以下:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.photogallery">
<application
android:label="图库1.0"
android:name=".PhotoApplication"
android:theme="@style/LaunchTheme"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
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>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
这个文件修改只是为了本地调试时方便看效果。