在Android Studio中如何将Flutter应用图标设为圆形并透明化背景?
Flutter圆形透明背景应用图标修改方案
准备工作
先处理原始logo:用图片编辑工具(PS/Figma/Canva等)将方形logo的背景扣为透明,保存为PNG格式,确保logo主体在画布中心。
Android端(Android Studio操作)
方法1:用Asset Studio自动生成
- 打开Flutter项目的
android模块(右键android文件夹 → Open Module in Android Studio)。 - 右键
app文件夹 → New → Image Asset,启动Asset Studio。 - 在「Icon Type」选择
Launcher Icons,点击Foreground Layer里的「Image」,选择你准备好的透明背景logo。 - 调整「Foreground Scaling」参数,让logo在圆形框内显示完整;然后在Background Layer中,将背景色设为透明(选颜色面板的透明选项,或输入
#00000000)。 - 「Shape」选择
Circle,点击Next → Finish,工具会自动生成全分辨率的圆形透明图标到mipmap系列文件夹。
方法2:手动替换
- 自己生成对应分辨率的圆形透明图标(mdpi/hdpi/xhdpi/xxhdpi/xxxhdpi)。
- 替换
android/app/src/main/res/mipmap-*目录下的ic_launcher.png和ic_launcher_round.png。 - 检查
AndroidManifest.xml的配置,确保引用正确:<application android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" ...>
iOS端操作
- 打开
ios/Runner/Assets.xcassets/AppIcon.appiconset文件夹,将所有尺寸的占位图标替换为你的圆形透明logo(每个尺寸对应图标要符合大小要求)。 - 或用Xcode打开
ios/Runner.xcworkspace,选中Assets.xcassets里的AppIcon,把每个尺寸位置拖入对应透明圆形图标。 - 确保1024x1024的App Store图标也为圆形透明格式。
通用快捷方案:用flutter_launcher_icons包
- 在
pubspec.yaml添加依赖:dev_dependencies: flutter_test: sdk: flutter flutter_launcher_icons: ^0.13.1 # 可替换为最新版本 - 在文件末尾添加配置:
flutter_launcher_icons: android: "launcher_icon" ios: true image_path: "assets/icon.png" # 你的透明背景logo路径 adaptive_icon_background: "#00000000" # Android自适应图标背景透明 ios_icon_background: transparent # iOS图标背景透明 - 执行命令:
工具会自动生成两端所需的圆形透明图标。flutter pub get flutter pub run flutter_launcher_icons:main
注意事项
- 必须使用透明背景的PNG图标,否则生成后背景仍会保留原颜色。
- 修改后需卸载旧应用再重新安装,或重启模拟器/真机,避免图标缓存不更新。
内容的提问来源于stack exchange,提问作者Me.2
相关产品推荐
相关产品推荐

