应用启动器图标已更改为Oreo上的默认图标 [英] app launcher icon changed to default icon on Oreo
问题描述
我创建了一个带有自己的启动器图标的Android应用.它与牛轧糖效果很好.但是在Oreo中,我的图标已替换为默认的Android图标.
我已经在Mipmap资源中定义了ic_launcher.png
和ic_launcher_round.png
的几种密度.
I have created an Android app with its own launcher icon. It worked well with Nougat. But with Oreo, my icon is replaced by the default Android icon.
I have defined ic_launcher.png
and ic_launcher_round.png
in the mipmap resources for several densities.
我的清单包含以下行:
android:roundIcon="@mipmap/ic_launcher_round"
我应该怎么做才能使自己的图标出现在奥利奥(Oreo)上?
What should I do to make my own icon appear on Oreo ?
推荐答案
对于API 26+,默认的Android应用程序模板定义了另一个图标资源文件夹
For API 26+ default Android application template defines another icon resource folder
mipmap-anydpi-v26
该文件夹(通常)包含两个xml
文件ic_launcher
和ic_launcher_round
,它们与API 26+清单中声明的图标资源相匹配
That folder (usually) contains two xml
files ic_launcher
and ic_launcher_round
that match icon resources declared in manifest for 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
和ic_launcher_foreground
In order to have your icon you also need to change all drawables (in all density buckets) listed there - namely ic_launcher_background
and ic_launcher_foreground
或者您可以只删除该文件夹,在这种情况下,android将回退到使用png图标,但它们不会原样显示,并且通常会绘制在白色背景上.
Or you can just delete that folder, in which case android will fallback to using your png icons, but they will not appear as-is and will be commonly drawn on top of white background.
您可以在以下位置阅读更多信息:自适应图标
You can read more at: Adaptive icons
这篇关于应用启动器图标已更改为Oreo上的默认图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!