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

标签 android android-launcher

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

“旧”方式

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

自适应图标

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

Next you must create alternative drawable resources in your app for use with Android 8.0 (API level 26) in res/mipmap-anydpi-v26/ic_launcher.xml. You can then use the element to define the foreground and background layer drawables for your icons.

<?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>

如果我的应用程序有:

minSdkVersion 26
targetSdkVersion 29

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

最佳答案

is it enough only to have the adaptive icons present?

是的。

您必须仅考虑您的最低 SDK 版本。如果您的最低 SDK 版本高于 API 21,您可以自由使用矢量绘图而不是 PNG。

其他来源:

关于android - SDK >=26 仍需要 mipmap/ic_launcher.png?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61286687/

相关文章:

android - 全局变量安全隐患

android - 如何更新带有隐藏图标的Android应用程序

java - 去另一个 Activity 时出错

ANDROID:是否可以像对讲机一样用蓝牙耳机通话?

java - Android Studio:PC关闭后库的内存不足(Java堆空间)错误

Android - 如何开始创建启动器应用程序?

java - 为什么 resolveInfo.loadLabel () 如此慢得离谱?

android - 检测android中主页按钮的点击事件(应用程序启动器图标)

android - 图标大小android,最常见的填充/大小facebook/youtube

java - 从 android 加密并在 CryptoJS 中解密