使用向量可绘制兼容性 [英] Using Vector Drawable Compat
本文介绍了使用向量可绘制兼容性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在制作带有一些片段的android应用.在这些片段之一中,我有一个带有后退箭头作为图像按钮的工具栏.
在XML文件中,我具有"app:srcCompat"属性,但是在使用该属性时出现错误:要使用VectorDrawableCompat,您需要设置'android.defaultConfig.vectorDrawables.useSupportLibrary = true'
I am making an android app with a few fragments. In one of these fragments, I have a toolbar with a back arrow as an image button.
In the XML File, I have the "app:srcCompat" attribute, but I get an error when using this attribute saying this: "To use VectorDrawableCompat, you need to set 'android.defaultConfig.vectorDrawables.useSupportLibrary = true'
推荐答案
在模块 build.gradle
文件中,您需要添加以下行:
In your module build.gradle
file, you need to add this line:
apply plugin: 'com.android.application'
android {
...
defaultConfig {
...
vectorDrawables.useSupportLibrary = true // This line here
}
...
}
...
这篇关于使用向量可绘制兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文