You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter Native Splash图标位置异常问题求助

Flutter Native Splash 启动页图标位置异常解决方案

问题分析

你的配置未针对不同Android版本正确设置图标居中参数,Android 12+的启动页需要单独指定居中属性,同时图标尺寸不规范也可能导致位置偏移。

解决方案步骤

1. 修正配置文件结构

将旧版Android和Android 12+的居中参数分别配置到对应区块,替换原有配置:

flutter_native_splash:
  color: "#455355"
  color_dark: "#455355"

  image: assets/images/splashIcon.png
  image_dark: assets/images/splashIcon.png

  android:
    enabled: true
    center: true  # 强制旧版Android图标居中
    # 可选:调整图标缩放比例,按需设置0-1之间的数值
    # image_scale: 0.8

  ios: true

  android_12:
    color: "#455355"
    color_dark: "#455355"
    image: assets/images/splashIcon.png
    image_dark: assets/images/splashIcon.png
    center: true  # Android 12+图标居中
    # 可选:自定义图标大小(单位dp)
    # icon_size: 200

2. 检查图标尺寸规范

确保splashIcon.png符合Android启动页要求:

  • 使用正方形图片,推荐尺寸为432x432px(适配普通密度屏)或864x864px(适配高密度屏)
  • 避免非正方形图片,防止自动拉伸导致位置偏移

3. 重新生成启动页并清理缓存

执行命令更新启动页资源:

flutter pub run flutter_native_splash:create

随后清理缓存并重新运行项目:

flutter clean
flutter run

内容的提问来源于stack exchange,提问作者Salami Tobi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.19 09:12:09