自适应图标不起作用 [英] Adaptive Icon not working
问题描述
清单:
<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">
在文件夹mipmap-anydpi-v26
下,我定义了ic_launcher.xml
:
under the folder mipmap-anydpi-v26
I have defined 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>
这是我的文件夹结构:
here is my folder structure :
build.gradle:
build.gradle:
compileSdkVersion = 26
buildToolsVersion = "25.0.2"
supportLibVersion = "25.3.1"
targetSdkVersion = 25
minSdkVersion = 18
而且,我正在使用android studio 3.0
AND, I'm using android studio 3.0
但是最终结果是我得到了一个默认的android图标,而不是我提供的图标.
but the end result is that I get a default android icon instead of the one I provided.
我也尝试将前景png放在所有密度文件夹(mipmap-xhdpi等)中,尽管在测试时我对所有png都使用了相同的png
I've also tried putting the foreground png in all of the density folders (mipmap-xhdpi, etc), although I used the same png for all when I did this just for testing
推荐答案
自适应图标需要API 26,因此您需要将buildtools更新到至少26.0.0版本
Adaptive icon requied API 26 so you need to update your buildtools to at least 26.0.0 version
这篇关于自适应图标不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!