1.下载svg文件,https://www.iconfont.cn/阿里的
2.通过AS - New - Vectro Asset转换成安卓可用的xml文件(ic_back.xml)
3.配置Gradle
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
4.<ImageView
app:srcapp:srcCompat="@drawable/ic_back"/>
代码改版svg颜色
VectorDrawableCompat vectorDrawableCompat = VectorDrawableCompat.create(getResources(), R.drawable.ic_back, getTheme());
//你需要改变的颜色
vectorDrawableCompat.setTint(Color.WHITE);
mImageView.setImageDrawable(vectorDrawableCompat);