我的launch_background.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap android:gravity="fill" android:src="@drawable/background"/>
</item>
</layer-list>
Run Code Online (Sandbox Code Playgroud)
我在drawable-v21中的launch_background.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap android:gravity="fill" android:src="@drawable/background"/>
</item>
</layer-list>
Run Code Online (Sandbox Code Playgroud)
我的安卓清单:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.my_app">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:label="my_app"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:theme="@style/LaunchTheme"
android:exported="true"
android:launchMode="singleTop"
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>
<!-- 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>
Run Code Online (Sandbox Code Playgroud)
我可以更改背景颜色,但图像始终是 android:icon="@mipmap/ic_launcher">。不管我做什么(在安卓上)。
jon*_*jon 10
问题的根源在于您需要在文件中进行设置 。不过,flutter_native_splash 2.1.0刚刚添加了新的配置参数,用于自动设置 Android 12 中的闪屏图标:<item name="android:windowSplashScreenAnimatedIcon">@drawable/...</item>values-v31/styles.xml
android_12:\n # The image parameter sets the splash screen icon image. If this parameter is not specified,\n # the app\'s launcher icon will be used instead.\n # Please note that the splash screen will be clipped to a circle on the center of the screen.\n # App icon with an icon background: This should be 960\xc3\x97960 pixels, and fit within a circle\n # 640 pixels in diameter.\n # App icon without an icon background: This should be 1152\xc3\x971152 pixels, and fit within a circle\n # 768 pixels in diameter.\n #image: assets/android12splash.png\n\n # App icon background color.\n #icon_background_color: "#111111"\n\n # The image_dark parameter and icon_background_color_dark set the image and icon background\n # color when the device is in dark mode. If they are not specified, the app will use the\n # parameters from above.\n #image_dark: assets/android12splash-invert.png\n #icon_background_color_dark: "#eeeeee"\nRun Code Online (Sandbox Code Playgroud)\n全面披露:我维护这个包。
\n| 归档时间: |
|
| 查看次数: |
7418 次 |
| 最近记录: |