传统的Android提供的动画只有平移、缩放、显示等效果,那么怎么才能实现逐渐绘制动画? 答案是使用矢量图动画。
一、 矢量图支持VectorDrawble
Android 系统从5.0开始支持矢量图,可以通过 Android Studio自带的 Vector Assert 工具将SVG、PSD 转成VectorDrawble。
矢量图兼容5.0以下使用需要v7支持库和以下配置:
compile 'com.android.support:appcompat-v7:23.2.0'
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
如下是Vector Assert 工具的使用方法:
image
image
转化成的VectorDrable格式如下:
android:name="root"
android:height="62dp"
android:viewportHeight="140.13"
android:viewportWidth="121.38"
android:width="53dp">
android:name="line1"
android:pathData="M59.94,3.22
l-58.9,36.2
v11
L59.94,14.22
l58.9,36.2
L118.84,39.42
Z"
android:strokeColor="@color/splash_logo_stroke"
android:strokeWidth="1"/>
android:name="line2"
android:pathData="M59.94,24.72
l58.9,36.2
v11
L59.94,35.72
l-58.9,36.2
L1.04,60.92<