应用图标启动器未在Android 7.1.1中显示 [英] App Icon Launcher not showing in Android 7.1.1

查看:202
本文介绍了应用图标启动器未在Android 7.1.1中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在实现圆形图标(带有前景和背景)和图标。

We are implementing a round icon (with a foreground and a background) and icon.

<application
    android:allowBackup="false"
    tools:replace="android:allowBackup"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:icon="@mipmap/logo" //normal logo
    android:roundIcon="@mipmap/logo_o" //Our logo with foreground and background
    android:name=".MyApplication"/>

适用于每个版本,但不适用于API 25

Works for every version but not for API 25

下一个带有背景的前景代码

Our code for Foreground with Background is the next one

<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@mipmap/logo_background"/>
    <foreground android:drawable="@mipmap/logo_foreground"/>
</adaptive-icon>


推荐答案

资源结构:

mipmap-anydpi-v25
   \  ic_launcher_round.xml
mipmap-anydpi-v26
   \  ic_launcher.xml
mipmap-*dpi
   \  ic_launcher.png

AndroidManifest.xml:

AndroidManifest.xml:

<application android:icon="@mipmap/ic_launcher"
             android:roundIcon="@mipmap/ic_launcher_round"

roundIcon 资源重定向 c $ c>资源,以确保在API级别26+上具有 v26 自适应图标:

Add resource redirection for the roundIcon resource so that you are guaranteed to have the v26 adaptive icon on API level 26+:

values-anydpi-v26
   \  drawables.xml

drawables.xml:

drawables.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <mipmap name="ic_launcher_round">@mipmap/ic_launcher</mipmap>
</resources>

这篇关于应用图标启动器未在Android 7.1.1中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆