我创建了一个带有自己的启动器图标的 Android 应用程序。它与牛轧糖配合得很好。但在 Oreo 中,我的图标被默认的 Android 图标取代。
我已经定义了ic_launcher.png
and ic_launcher_round.png
在多种密度的 mipmap 资源中。
我的清单包含以下行:
android:roundIcon="@mipmap/ic_launcher_round"
我应该怎么做才能让我自己的图标出现在奥利奥上?
对于 API 26+ 默认 Android 应用程序模板定义了另一个图标资源文件夹
mipmap-anydpi-v26
该文件夹(通常)包含两个xml
files ic_launcher
and ic_launcher_round
与 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>
为了拥有您的图标,您还需要更改那里列出的所有可绘制对象(在所有密度桶中) - 即ic_launcher_background
and ic_launcher_foreground
或者您可以删除该文件夹,在这种情况下,android 将回退到使用您的 png 图标,但它们不会按原样显示,并且通常会绘制在白色背景上。
您可以在以下位置阅读更多内容:自适应图标
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)