我使用AndroidStudio2.3.3稳定并试图为Android创建适应性图标
我创建了包含以下内容的文件夹mipmap-anydpi-v26和ic_launcher.xml文件
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/colorAccent"/>
<foreground android:drawable="@drawable/ic_launcher_adaptive"/>
</adaptive-icon>但是它说“元素自适应图标必须声明”。目标SDK和构建工具都被设置为26。
它构建成功,但我没有任何设备来测试它,所以我的问题是-它工作吗?
P.S.:前台是有效的VectorDrawable
发布于 2017-08-04 11:04:23
我建议您从Android虚拟设备管理器中创建一个Android虚拟设备,用于测试适应性图标。我在AndroidStudio2.3.3中也出现了同样的错误。似乎AndroidStudio2.3.3不支持自适应图标标记。为此,我们需要获得AndroidStudio3.0。
即使是Android开发者网站中的适应性图标文档也显示了AndroidStudio3.0屏幕截图
https://developer.android.com/preview/features/adaptive-icons.html
编辑:-我已经检查并发现,Adaptive在AndroidStudio2.3.3的应用程序构建中运行良好,而不管“元素自适应图标必须声明”错误。
发布于 2017-10-24 12:52:10
ic_launcher.xml应该是这样的
<?xml version="1.0" encoding="utf-8"?>
<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>https://stackoverflow.com/questions/45411813
复制相似问题