应用启动器图标已更改为Oreo上的默认图标

时间:2018-07-14 09:21:40

标签: android launcher android-8.0-oreo

我用自己的启动器图标创建了一个Android应用程序。它与牛轧糖效果很好。但是在Oreo中,我的图标已替换为默认的Android图标。 我已经在mipmap资源中定义了ic_launcher.pngic_launcher_round.png的几种密度。

我的清单包含以下行:

android:roundIcon="@mipmap/ic_launcher_round"

如何使自己的图标出现在Oreo上?

3 个答案:

答案 0 :(得分:10)

对于API 26+,默认的Android应用程序模板定义了另一个图标资源文件夹

mipmap-anydpi-v26

该文件夹(通常)包含两个xml文件ic_launcheric_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_backgroundic_launcher_foreground

或者您也可以只删除该文件夹,在这种情况下,android将回退到使用png图标,但它们不会原样显示,并且通常会绘制在白色背景上。

答案 1 :(得分:3)

最好的解决方法是删除mipmap-anydpi-v26文件夹,然后应用将使用默认图标。在android studio项目模式下,转到此包

  

res / mipmap-anydpi-v26

删除它并重建并运行Project。

答案 2 :(得分:0)

我的解决方案: 检查 res/mipmap-anydpi-v26 文件夹,然后您将看到 ic_launcher.xml 和 ic_launcher_round.xml 文件 编辑这些 xml 文件以指向您要使用的实际 png 文件:

如果 drawable 文件夹中没有此类 png 文件,请添加它。

这就解决了问题。

相关问题