android - Replacing app launcher icon in flutter with new icon
问题描述
I was looking for changing the app icon
of my current app. I cane around the package name flutter_launcher_icons
.
I also found I can do by putting an image in mipmap-xxxhdpi
in android/app/res
folder. And it works.
So my question is why we need additional package(flutter_launcher_icons
) for this.
解决方案
当您使用该包flutter_launcher_icons
时,它会自动为应用程序生成不同的图标大小,这比仅将图像mipmap-xxxhdpi
放入android/app/res
.
例如,如果您添加flutter_launcher_icons
到pubspec.yaml
:
dev_dependencies:
flutter_launcher_icons: "^0.7.3"
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icon/icon.png"
然后执行以下命令:
flutter pub get
flutter pub run flutter_launcher_icons:main
它将在res
文件夹中为android和Assets.xcassets
ios生成不同大小的所有图标。
在这里查看更多信息:
推荐阅读
- c++ - Typedef 重命名类以实现跨平台兼容性
- devops - 如何防止游牧任务退出?
- javascript - 单击然后添加活动类但 Isotope.js 过滤器不起作用
- nunit - 运行长时间运行的 NUnit/xUnit 测试,这样它们就不会阻塞其他测试
- python - 如何从请求到 requests_html 进行会话?
- python-3.6 - AWS cdk python,具有每日触发器的胶水爬虫的哪个IAM角色?
- php - PHP,多维数组,从数组中查找键和返回值
- javascript - Prisma 中的数据建模与关系
- python - 如何读取文本文件中的行并替换 Python 中的整行?
- django - 是否可以对 Django 平面页面进行 dockerize 处理?