-
指令和数据间的空格可以省略
-
同一指令出现多次可以只用一个
注意,'M’处理时,只是移动了画笔, 没有画任何东西。 它也可以在后面给出上同时绘制不连续线。
AS生成vector,使用as系统图标
在androidStudio其实已经有很多系统使用的图标了,我们在使用时其实可以不用UI再次进行切图,直接使用就是了!
- 使用步骤:File->New->Vector Asset;(如果选择Image Assets导出的是PNG格式图片)
- 然后选择Material Icon,然后点击小机器人
- 这里有所有的系统图片,选择你想用的就好了
- 例如我使用的是一个五角星,显示效果如下:
mImageview.setImageResource(R.drawable.ic_star_black_24dp);
使用外部SVG(PSD)导入vector
-
File->New->Vector Asset;(如上图,这里不再给图)
-
然后选择Local file,然后选择path
- 兼容anroid5.0以下
在app的build.glide中
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
在Application中
/**
- 兼容5.0以下系统
*/
static {
/获取当前系统的android版本号/
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
if (currentapiVersion < 21)//适配android5.0以下
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)