不久前,我制作了一个简单的Android应用程序--一个上传数据的共享意图处理程序。
现在我为它设计了一个新的SVG图标,作为矢量图形导入到项目中,然后用InkScape转换成一系列的PNG,并替换了项目中的所有PNG。
该应用程序现在显示在新图标上。
但是Android11 (API等级30,三星Galaxy A50,股票固件)仍然显示出旧的图标。
应用程序中不再有默认图标(带耳朵的绿色android头)可以驻留的地方了!
可能是默认的图标显示时,某些预期的资源是简单地丢失?
我在以下文件中用新的图像替换了图像:
我注意到app\src\main\res\drawable\文件夹中没有app\src\main\res\drawable\,只有app\src\main\res\drawable-v24\中没有。这是正常的吗?
我的app\src\main\res\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>当我在Android中点击@drawable/ic_launcher_foreground时,它会引导我进入app\src\main\res\drawable-v24\ic_launcher_foreground.xml。
发布于 2022-08-30 13:11:22
您应该尝试从
->可绘图->右键单击->新->添加图像资产->启动器图标
改变你的发射图标在那里,它应该是正确的,到处可见。
发布于 2022-09-09 03:32:53
尝试将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>至
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon>adaptive-icon只在Android8 (SDK 26)和更高版本上使用,所以运行Android11的设备引用该文件,而运行较旧版本的Android的设备则不是。
https://stackoverflow.com/questions/73542912
复制相似问题