在新的安卓系统中如何删除旧应用程序图标

4

不久前,我制作了一个简单的Android应用程序 - 一个共享意图处理程序,用于上传数据。

现在,我为它设计了一个新的SVG图标,将其作为矢量图形导入项目,然后使用InkScape转换为一系列PNG,并替换项目中的所有PNG。

该应用程序现在在以下设备上显示新图标:

  • Android 4.3(SGS3,原始固件)
  • 和Android 7.1(SGS2,LineageOS)

但是Android 11(API级别30,三星Galaxy A50,原始固件)仍显示旧图标。

应用程序中没有剩余的默认图标(带有绿色安卓头和耳朵)的位置!!!

也许当某些预期的资源缺失时,会显示默认图标?

我在以下文件中用新文件替换了旧图片:

  • app \ src \ main \ res \ drawable-v24 \ ic_launcher_foreground.xml
  • app \ src \ main \ res \ mipmap-hdpi \ ic_launcher.png
  • app \ src \ main \ res \ mipmap-mdpi \ ic_launcher.png
  • app \ src \ main \ res \ mipmap-xhdpi \ ic_launcher.png
  • app \ src \ main \ res \ mipmap-xxhdpi \ ic_launcher.png
  • app \ src \ main \ res \ mipmap-xxxhdpi \ ic_launcher.png
  • app \ src \ main \ res \ mipmap-hdpi \ ic_launcher_round.png
  • app \ src \ main \ res \ mipmap-mdpi \ ic_launcher_round.png
  • app \ src \ main \ res \ mipmap-xhdpi \ ic_launcher_round.png
  • app \ src \ main \ res \ mipmap-xxhdpi \ ic_launcher_round.png
  • app \ src \ main \ res \ mipmap-xxxhdpi \ ic_launcher_round.png

我注意到在app \ src \ main \ res \ drawable \文件夹中没有ic_launcher_foreground.xml,只有在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 Studio中Ctrl + 单击@drawable/ic_launcher_foreground时,它会带我到app\src\main\res\drawable-v24\ic_launcher_foreground.xml


你试过重新启动手机吗? - gioravered
刚刚我删除了应用,关掉/打开了手机并从Android Studio启动了手机上的USB调试。在Android 11,API级别30上,该应用程序仍带有旧图标。 - Paul
在清单文件中,android:roundIconandroid:icon这两个条目下分别有什么内容? - Stachu
当您打开 @drawable/ic_launcher_background@drawable/ic_launcher_foreground 文件时,您会看到哪个标志或图像? - Vishal Beep
app\src\main\res\drawable-v24\ic_launcher_foreground.xml 文件中它是什么样子的? - Vishal Beep
显示剩余4条评论
3个回答

1

你可以尝试从res -> drawable中添加图标:

右键单击 -> 新建 -> 添加图像资源 -> 启动器图标

在那里更改您的启动器图标,它应该能够正确地显示在任何地方。


抱歉:添加图像资源->启动器图标 - 它在哪里?图标类型=启动器图标(自适应和传统)?是这些吗?我已经尝试过了,但效果并不比手动替换好。 - Paul
是的,您应该从res->drawable中添加,然后右键单击drawable文件夹,然后按照上面给出的路径进行操作,最后它会要求上传png图像。 - Karan Mehta
我已经完成了。默认图标仍然存在。 - Paul

0

enter image description here

只需撤销你替换所有PNG文件时所做的操作。
你应该按照我为你发布的这张图片进行操作。
使用这个图像资源工具,你可以轻松地为传统版本和最新版本创建应用程序启动器图标。

-1

尝试更改您的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>

自适应图标仅用于 Android 8 (SDK 26) 及以上版本,因此运行 Android 11 的设备正在引用此文件,而运行早期版本 Android 的设备则未使用。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接