Sia*_*ash 13 android android-8.0-oreo
表现:
<application
android:name="..."
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/MyTheme"
tools:replace="icon,label,theme,name,allowBackup">
Run Code Online (Sandbox Code Playgroud)
在mipmap-anydpi-v26我定义的文件夹下ic_launcher.xml:
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/white"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Run Code Online (Sandbox Code Playgroud)
的build.gradle:
compileSdkVersion = 26
buildToolsVersion = "25.0.2"
supportLibVersion = "25.3.1"
targetSdkVersion = 25
minSdkVersion = 18
Run Code Online (Sandbox Code Playgroud)
而且,我正在使用android studio 3.0
但最终结果是我得到了一个默认的android图标而不是我提供的图标.
我也尝试将前景png放在所有的密度文件夹(mipmap-xhdpi等)中,虽然我在执行此操作时只使用相同的png进行测试
自适应图标需要API 26,因此您需要将buildtools更新为至少26.0.0版本
我也遇到了同样的问题,这是我解决这个问题的方法
右键单击资源 -> 新建 -> ImageAsset
选择 ic_launcher_background 图标和 ic_launcher_foreground ,如下图所示
Android studio在资源mipmap下创建ic_launcher.xml (anydpi-v26)
<?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>
Run Code Online (Sandbox Code Playgroud)现在在 Manifest.XML 中,声明图标和圆形图标,如下所示
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme">
.......</application>
Run Code Online (Sandbox Code Playgroud)
是的,就是这样,在出现的任何设备上运行您的应用程序
| 归档时间: |
|
| 查看次数: |
6816 次 |
| 最近记录: |