概述
完全取代简单的图标,在各种分辨率的屏幕上都不会失真.
使用步骤
1.先在gradle里配置参数
目的是让矢量图在5.0前的手机上也正常显示
apply plugin: 'com.android.library'
android {
... ...
defaultConfig {
//配置这个参数
vectorDrawables.useSupportLibrary = true
}
... ...
}
2.drawable –> 右键 –> new –> vector assets里建好。
(0)首先给布局指定命名空间
xmlns:app="http://schemas.android.com/apk/res-auto"
(1)给控件指定矢量图,必须下面用的方式。