gpt4 book ai didi

android - XmlPullParserException : invalid drawable tag vector

转载 作者:IT老高 更新时间:2023-10-28 23:40:31 32 4
gpt4 key购买 nike

我正在使用 NDK 支持并收到此错误:

分级:

分布:gradle-2.5-all

构建工具:gradle-experimental:0.2.1

XML:

    <vector android:height="24dp" android:viewportHeight="125.0"
android:viewportWidth="100.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M97.01,-2.98,-3C47.02,95.35"/>
</vector>

警告:

vector requires API level 21 (current min is 13) or building with Android Gradle plugin 1.4 or higher

异常(exception):

  FATAL EXCEPTION: main
android.content.res.Resources$NotFoundException: File res/drawable/accelerometer.xml from drawable resource ID #0x7f020045
at android.content.res.Resources.loadDrawable(Resources.java:2842)
at android.content.res.Resources.getDrawable(Resources.java:1521)

...
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:917)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:858)

最佳答案

在 Lollipop 之前的设备上,您需要使用 VectorDrawableCompat 从资源中获取矢量。

 someVectorDrawable = VectorDrawableCompat.create(context.getResources(), R.drawable.[some res id], null);

然后你可以设置你的 ImageView 的背景。

关于android - XmlPullParserException : invalid drawable tag vector,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34513971/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com