应用图标需要放在以下目录中,每个目录对应不同的屏幕密度:
app/src/main/res/
├── mipmap-mdpi/ ← 48x48 px (中密度)
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
├── mipmap-hdpi/ ← 72x72 px (高密度)
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
├── mipmap-xhdpi/ ← 96x96 px (超高密度)
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
├── mipmap-xxhdpi/ ← 144x144 px (超超高密度)
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
├── mipmap-xxxhdpi/ ← 192x192 px (超超超高密度)
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
└── mipmap-anydpi-v26/ ← Android 8.0+ 自适应图标
├── ic_launcher.xml
└── ic_launcher_round.xml
| 密度 | 文件夹 | 尺寸 (px) |
|---|---|---|
| MDPI | mipmap-mdpi | 48 x 48 |
| HDPI | mipmap-hdpi | 72 x 72 |
| XHDPI | mipmap-xhdpi | 96 x 96 |
| XXHDPI | mipmap-xxhdpi | 144 x 144 |
| XXXHDPI | mipmap-xxxhdpi | 192 x 192 |
支持的输入格式:PNG, JPG, SVG, PSD
app 模块New → Image AssetLauncher Icons (Adaptive and Legacy)#FFB7C5)或上传背景图Next → Finish优点:
如果你有 SVG 文件,可以使用在线工具转换:
推荐工具:
Android Asset Studio: https://romannurik.github.io/AndroidAssetStudio/
CloudConvert: https://cloudconvert.com/svg-to-png
Figma/Sketch/Adobe XD:
步骤:
注意:mipmap 文件夹只支持位图格式(PNG/WebP/JPG),不支持 SVG
如果你想手动替换:
ic_launcher.webp 或 ic_launcher.pngSVG 可以转换为 Android Vector Drawable (XML)
如果你想在自适应图标中使用矢量图:
在 Android Studio 中:
res/drawableNew → Vector AssetLocal file (SVG, PSD)Next → Finish这会生成一个 XML 矢量图标文件
然后在 ic_launcher_foreground.xml 中引用它
示例:
<!-- res/drawable/ic_launcher_foreground.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<!-- SVG 转换后的路径数据 -->
<path
android:fillColor="#FFFFFF"
android:pathData="M50,20 L80,80 L20,80 Z"/>
</vector>
推荐工具:
步骤:
对于 Android 8.0 及以上版本,使用自适应图标:
app/src/main/res/drawable/ic_launcher_foreground.xml
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<!-- 你的图标路径 -->
</vector>
app/src/main/res/drawable/ic_launcher_background.xml
可以是纯色或矢量图:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#FFB7C5"
android:pathData="M0,0h108v108h-108z"/>
</vector>
根据你的应用主题色(樱花粉 #FFB7C5),建议:
#FFB7C5替换图标后:
Build → Clean ProjectBuild → Rebuild Project你的应用图标在 AndroidManifest.xml 中配置:
<application
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
...>
如果你想使用不同的图标名称,需要同时修改 AndroidManifest.xml。