【问题标题】:Adaptive icons not working in Oreo - why?自适应图标在奥利奥中不起作用 - 为什么?
【发布时间】:2020-04-01 20:56:32
【问题描述】:

我正在尝试通过右键单击 res 文件夹 -> new -> Image asset,将 SVG 文件中的自定义图标添加到我的 Android 应用程序。我使用我的 SVG 选择了默认选项,但在运行应用程序时看不到图标。 我在安装之前尝试了一个clean project 和一个invalidate cache and restart,结果是一样的。

我还意识到mipmap-anydpi-v26/ic_launcher.xml 显示了我在安装我的应用程序时看到的默认图标。该文件包含:

<?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>

单击@drawable/ic_launcher_foreground 时,我会打开以下位置:drawabledrawable-24。第一个显示了我最近更新的图标,但drawable-24 显示了我在安装我的应用程序时看到的默认 Android 图标。

这里有什么我遗漏的吗?我还有什么需要做的吗?

谢谢!

【问题讨论】:

    标签: android android-icons adaptive-icon


    【解决方案1】:

    drawable-24 文件夹的优先级高于drawable

    与未指定的资源相比,Android 总是更喜欢特定于 API 的资源,以及特定于分辨率和特定语言的资源。

    【讨论】:

      【解决方案2】:

      嗯,最后,我只是从 PNG 而不是 SVG 创建了图标,效果很好。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-07-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多