android - 应用启动器图标更改为奥利奥上的默认图标
问题描述
我创建了一个带有自己的启动器图标的 Android 应用程序。它与牛轧糖配合得很好。但是使用 Oreo,我的图标被默认的 Android 图标取代。我已经在 mipmap 资源中定义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>
为了拥有您的图标,您还需要更改那里列出的所有可绘制对象(在所有密度桶中) - 即ic_launcher_background
和ic_launcher_foreground
或者您可以删除该文件夹,在这种情况下,android 将回退到使用您的 png 图标,但它们不会按原样显示,并且通常会绘制在白色背景之上。
您可以在以下位置阅读更多信息:自适应图标
推荐阅读
- javascript - Webpack 脚本执行顺序
- session - Joomla 网站上的警告错误
- php - 使用函数在 Wordpress 中获取部分标题
- r - 从数据框中创建多个子集
- css - 减少角度材料树中的线高
- protractor - 量角器使用 browser.wait 控制测试流程的正确方法
- java - 我无法在 AVD manager(Android studio) 上创建或下载系统
- php - 在 PHP 中上传 5000kb pdf 文件或图像不起作用
- javascript - 访问 props().x 返回 undefined
- java - Main_Activity 启动崩溃