Android 应用程序启动器图标更改为Oreo上的默认图标
我已经创建了一个Android应用程序,它有自己的启动图标。它与牛轧糖一起使用效果很好。但在Oreo中,我的图标被默认的Android图标取代。 我在mipmap资源中定义了几个密度的Android 应用程序启动器图标更改为Oreo上的默认图标,android,launcher,android-8.0-oreo,Android,Launcher,Android 8.0 Oreo,我已经创建了一个Android应用程序,它有自己的启动图标。它与牛轧糖一起使用效果很好。但在Oreo中,我的图标被默认的Android图标取代。 我在mipmap资源中定义了几个密度的ic_launcher.png和ic_launcher_round.png 我的清单包含以下行: android:roundIcon="@mipmap/ic_launcher_round" 我应该怎么做才能使我自己的图标出现在Oreo上?对于API 26+默认Android应用程序模板定义了另一个图标资源文件夹
ic_launcher.png
和ic_launcher_round.png
我的清单包含以下行:
android:roundIcon="@mipmap/ic_launcher_round"
我应该怎么做才能使我自己的图标出现在Oreo上?对于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>
最佳解决方案是删除mipmap-anydpi-v26文件夹,然后应用程序将采用默认图标。在android studio项目模式下,转到此软件包
res/mipmap-anydpi-v26
删除它并重新生成并运行Project。我的解决方案:
检查res/mipmap-anydpi-v26文件夹,然后您将看到ic_launcher.xml和ic_launcher_round.xml文件
编辑这些xml文件以指向要使用的实际png文件:
如果该png文件在drawable文件夹中不可用,请添加它
这就解决了问题。谢谢Dalija。我没有注意到这个mipmap-anydpi-v26文件夹。我刚把它取下来,现在在奥利奥上效果很好。稍后我会检查我能用这个“自适应图标”做些什么。@VadimKotov我添加了自适应图标的链接。Android Studio中的默认模板及其内容没有AFAIK文档记录。