android 在Image Asset Studio中创建启动器图标时,anydpi-v26出现问题

mfuanj7w  于 2023-02-20  发布在  Android
关注(0)|答案(4)|浏览(329)

在Image Asset Studio中使用剪贴画创建启动器图标(自适应和传统)时,将在mipmap文件夹中创建图像:

但是对于anydpi-v26,前景的标准图标没有改变,尽管背景颜色改变了:

ic_启动器.xml(任何dpi-v26):

<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@color/ic_launcher_background"/>
    <foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

在ic_launcher_foreground文件夹中有两个文件:ic_启动程序_foregraund. xml(新图标)和ic_启动程序_foregraund. xml(v24)(标准图标)
为什么他不自动换到新的图纸?谢谢你的回答!

nbysray5

nbysray51#

我遇到了同样的问题。同样的解决方案。由于某种原因,当创建新的启动器图标时,老文件ic_launcher_foreground. xml在drawable文件夹中没有被删除。你最终得到了两个同名的文件。所以删除它(没有安全删除),解决了这个问题。

bqujaahr

bqujaahr2#

我从文件夹中删除了ic_launcher_foreground.xml(v24)文件:res/drawable/ic_launcher_foreground/,它保留了标准图标。
此操作解决了问题:

ubof19bj

ubof19bj3#

我遇到这个问题是因为我的一个库定义了一个启动器图标。奇怪的是,应用程序模块从应用程序模块读取ic_launcher_background,但从库模块读取ic_launcher_foreground。

i7uq4tfw

i7uq4tfw4#

@aaronmarino的答案是正确的,我找到的唯一一个从app模块使用ic_launcher_foreground的解决方案就是重命名为ic_launcher_foreground_something.xml

<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@drawable/ic_launcher_background_something"/>
    <foreground android:drawable="@drawable/ic_launcher_foreground_something"/>
</adaptive-icon>

相关问题