相关疑难解决方法(0)

SDK >=26 仍需要 mipmap/ic_launcher.png?

在 Android 中,有两种指定启动器图标(可以说是应用程序图标)的方法:

“老”方式

在 mipmap 文件夹中指定不同的 png 文件,通常命名为 ic_launcher.png,但可以通过以下方式设置名称android:icon="@mipmap/appicon_android"

自适应图标

参考https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive。这里的图标由前面和背景可绘制对象组成(请参阅上面提到的链接以获取完整说明)。安卓 说:

接下来,您必须在应用程序中在 res/mipmap-anydpi-v26/ic_launcher.xml 中创建替代可绘制资源,以便与 Android 8.0(API 级别 26)一起使用。然后,您可以使用该元素来定义图标的前景和背景图层可绘制对象。

<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@drawable/ic_launcher_background" />
    <foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
Run Code Online (Sandbox Code Playgroud)

如果我的应用程序有:

minSdkVersion 26
targetSdkVersion 29
Run Code Online (Sandbox Code Playgroud)

是否仍应包含“旧”方式 png 文件,或者仅存在自适应图标就足够了?

android android-launcher

2
推荐指数
1
解决办法
1718
查看次数

标签 统计

android ×1

android-launcher ×1