Android SVG未在带有API的设备中加载支持库<;21

Android SVG未在带有API的设备中加载支持库<;21,android,svg,android-support-library,Android,Svg,Android Support Library,基于此,我添加了svg支持: android { defaultConfig { vectorDrawables.useSupportLibrary = true } } 还可以使用编译'com.android.support:appcompat-v7:23.4.0' 我使用svg作为New->vectorAsset并创建一个可绘制的向量 在xml中,我使用ImageView中的app:srccomat属性,而不是android:src 我尝试了s

基于此,我添加了svg支持:

android {  
   defaultConfig {  
       vectorDrawables.useSupportLibrary = true  
   }  
}  
还可以使用
编译'com.android.support:appcompat-v7:23.4.0'

我使用svg作为
New
->
vectorAsset
并创建一个可绘制的向量 在xml中,我使用ImageView中的
app:srccomat
属性,而不是
android:src

我尝试了
setImageResource()
编程


但是向量不会加载到带有API的设备中您在
srccomat
中引用的资源是什么?SVG?如果是这样,你就不能那样做。支持库不添加对SVG的支持。它为旧版本的Android增加了对矢量绘图的支持

您必须将SVG转换为矢量绘图。为此,右键单击您的
res
文件夹并执行
New
->
Vector-Asset
导入SVG

请注意,SVG转换器并不是非常复杂,矢量绘图只支持SVG功能的一个子集


如果确实需要使用SVG,则必须使用其中一个第三方库来呈现SVG。

当然不能。我将它用作
新的
->
向量资源
,但在旧设备上渲染它并不幸运。