Flutter Android端启动页Splash Icon显示异常求助
Flutter Android启动页图标放大变形模糊问题求助
我在Flutter开发中遇到Android端启动页问题:启动页背景颜色显示正常,但Splash Icon出现放大、变形且带有像素化模糊的情况。
已做的排查工作:
- 反复核对图标尺寸规范
- 制作适配不同屏幕密度的多尺寸图标
- 严格遵循Android官方文档的启动页配置要求及示例
但问题仍未解决。
相关代码文件:
values-night/styles.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 on --> <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> <!-- Show a splash screen on the activity. Automatically removed when the Flutter engine draws its first frame --> <item name="android:forceDarkAllowed">false</item> <item name="android:windowFullscreen">false</item> <item name="android:windowDrawsSystemBarBackgrounds">false</item> <item name="android:windowSplashScreenBackground">#FFCF4A</item> <item name="android:windowSplashScreenAnimatedIcon">@drawable/trans_icon_2</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.Black.NoTitleBar"> <item name="android:windowBackground">?android:colorBackground</item> </style> </resources>
values-night-v31/styles.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.Black.NoTitleBar"> <item name="android:forceDarkAllowed">false</item> <item name="android:windowFullscreen">false</item> <item name="android:windowDrawsSystemBarBackgrounds">false</item> <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item> <item name="android:windowSplashScreenBackground">#FFCF4A</item> <item name="android:windowSplashScreenAnimatedIcon">@drawable/trans_icon_2</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.Black.NoTitleBar"> <item name="android:windowBackground">?android:colorBackground</item> </style> </resources>
values-v31/styles.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"> <item name="android:forceDarkAllowed">false</item> <item name="android:windowFullscreen">false</item> <item name="android:windowDrawsSystemBarBackgrounds">false</item> <item name="android:windowSplashScreenBackground">#FFCF4A</item> <item name="android:windowSplashScreenAnimatedIcon">@drawable/trans_icon_2</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>
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package=""> <application android:label="" android:name="${applicationName}" android:icon="@mipmap/launcher_icon"> <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"/> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> </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" /> <meta-data android:name="" android:value="high_importance_channel"/> </application> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> </manifest>
启动页效果截图

内容的提问来源于stack exchange,提问作者jfchua
相关产品推荐
相关产品推荐

