使用支持库23.2,一直到API v7都对Vector Drawables提供了真正的支持。建议通过添加以下内容来禁用该支持的先前版本:该支持在构建期间呈现PNG
// Gradle Plugin 2.0+ android { defaultConfig { vectorDrawables.useSupportLibrary = true } }
到
build.gradle文件。
实现非常简单。只需在Drawables上使用新的srcCompat属性即可:
<ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" app:srcCompat="@drawable/ic_add" /> <= this is new
在诸如TextView的
drawableLeft属性的情况下,也支持Vector Drawable 。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)