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

Lau*_* D. 5 android launcher android-8.0-oreo

我创建了一个带有自己的启动器图标的Android应用.它与Nougat合作得很好.但是对于Oreo,我的图标被默认的Android图标取代.我已经定义ic_launcher.pngic_launcher_round.png在数密度的纹理贴图资源.

我的清单包含以下行:

android:roundIcon="@mipmap/ic_launcher_round"
Run Code Online (Sandbox Code Playgroud)

我应该怎么做才能在奥利奥上出现自己的图标?

Dal*_*kar 14

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

mipmap-anydpi-v26

该文件夹(通常)包含两个xml文件ic_launcher,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>
Run Code Online (Sandbox Code Playgroud)

为了获得你的图标你还需要更改那里列出的所有drawables(在所有密度桶中) - 即ic_launcher_backgroundic_launcher_foreground

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


sas*_*mar 5

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

分辨率/ mipmap-anydpi-v26

删除它并重建并运行项目。