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

在Android Studio中如何将Flutter应用图标设为圆形并透明化背景?

Flutter圆形透明背景应用图标修改方案

准备工作

先处理原始logo:用图片编辑工具(PS/Figma/Canva等)将方形logo的背景扣为透明,保存为PNG格式,确保logo主体在画布中心。


Android端(Android Studio操作)

方法1:用Asset Studio自动生成

  1. 打开Flutter项目的android模块(右键android文件夹 → Open Module in Android Studio)。
  2. 右键app文件夹 → New → Image Asset,启动Asset Studio。
  3. 在「Icon Type」选择Launcher Icons,点击Foreground Layer里的「Image」,选择你准备好的透明背景logo。
  4. 调整「Foreground Scaling」参数,让logo在圆形框内显示完整;然后在Background Layer中,将背景色设为透明(选颜色面板的透明选项,或输入#00000000)。
  5. 「Shape」选择Circle,点击Next → Finish,工具会自动生成全分辨率的圆形透明图标到mipmap系列文件夹。

方法2:手动替换

  1. 自己生成对应分辨率的圆形透明图标(mdpi/hdpi/xhdpi/xxhdpi/xxxhdpi)。
  2. 替换android/app/src/main/res/mipmap-*目录下的ic_launcher.png和ic_launcher_round.png。
  3. 检查AndroidManifest.xml的配置,确保引用正确:
    <application
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher_round"
        ...>
    

iOS端操作

  1. 打开ios/Runner/Assets.xcassets/AppIcon.appiconset文件夹,将所有尺寸的占位图标替换为你的圆形透明logo(每个尺寸对应图标要符合大小要求)。
  2. 或用Xcode打开ios/Runner.xcworkspace,选中Assets.xcassets里的AppIcon,把每个尺寸位置拖入对应透明圆形图标。
  3. 确保1024x1024的App Store图标也为圆形透明格式。

通用快捷方案:用flutter_launcher_icons包

  1. 在pubspec.yaml添加依赖:
    dev_dependencies:
      flutter_test:
        sdk: flutter
      flutter_launcher_icons: ^0.13.1 # 可替换为最新版本
    
  2. 在文件末尾添加配置:
    flutter_launcher_icons:
      android: "launcher_icon"
      ios: true
      image_path: "assets/icon.png" # 你的透明背景logo路径
      adaptive_icon_background: "#00000000" # Android自适应图标背景透明
      ios_icon_background: transparent # iOS图标背景透明
    
  3. 执行命令:
    flutter pub get
    flutter pub run flutter_launcher_icons:main
    
    工具会自动生成两端所需的圆形透明图标。

注意事项

  • 必须使用透明背景的PNG图标,否则生成后背景仍会保留原颜色。
  • 修改后需卸载旧应用再重新安装,或重启模拟器/真机,避免图标缓存不更新。

内容的提问来源于stack exchange,提问作者Me.2

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.12 13:50:40