提问者:小点点

在新Android上摆脱旧的应用程序图标


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

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

应用程序现在显示在新图标上

  • Android 4.3(SGS3,库存固件)
  • 和Android 7.1(SGS2,LineageOS)

但是Android11(API30级,三星银河A50,股票固件)仍然显示旧图标。

有没有更多的地方留在应用程序中的默认图标(绿色android头耳朵)可以居住!

可能是默认图标显示时,一些预期的资源只是缺少?

我用以下文件中的新图像替换了图像:

  • app\s rc\main\res\Draw able-v 24\ic_launcher_foreground. xml
  • app\s rc\main\res\m ip map-h dpi\ic_launcher. png
  • app\s rc\main\res\m ip map-m dpi\ic_launcher. png
  • app\s rc\main\res\m ip map-xh dpi\ic_launcher. png
  • app\s rc\main\res\m ip map-xx h dpi\ic_launcher. png
  • app\s rc\main\res\m ip map-xxx h dpi\ic_launcher. png
  • app\s rc\main\res\m ip map-h dpi\ic_launcher_round. png
  • app\s rc\main\res\m ip map-m dpi\ic_launcher_round. png
  • app\s rc\main\res\m ip map-xh dpi\ic_launcher_round. png
  • app\s rc\main\res\m ip map-xx h dpi\ic_launcher_round. png
  • app\s rc\main\res\m ip map-xxx h dpi\ic_launcher_round. png

我注意到在app\src\main\res\抽屉\文件夹中没有ic_launcher_foreground. xml,只有在app\src\main\res\抽屉-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


共2个答案

匿名用户

您应该尝试添加图标

资源-

在那里更改您的启动器图标,它应该可以正确地在任何地方看到。

匿名用户

尝试更改您的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(SDK26)及更高版本,因此运行Android 11的设备会引用此文件,而运行旧版本Android的设备则不会。