android vector矢量图

来源:互联网 发布:数据保护线缠绕方法 编辑:程序博客网 时间:2024/06/05 07:33

常用属性

  • android:name 定义该 path 的名字,这样在其他地方可以通过名字来引用这个路径
  • android:pathData 和 SVG 中 d 元素一样的路径信息。
  • android:fillColor 定义填充路径的颜色,如果没有定义则不填充路径
  • android:strokeColor 定义如何绘制路径边框,如果没有定义则不显示边框
  • android:strokeWidth 定义路径边框的粗细尺寸
  • android:strokeAlpha 定义路径边框的透明度
  • android:fillAlpha 定义填充路径颜色的透明度
  • android:trimPathStart 从路径起始位置截断路径的比率,取值范围从 0 到1
  • android:trimPathEnd 从路径结束位置截断路径的比率,取值范围从 0 到1
  • android:trimPathOffset 设置路径截取的范围 Shift trim region (allows showed region to include the start and end), in the range from 0 to 1.
  • android:strokeLineCap 设置路径线帽的形状,取值为 butt, round, square.
  • android:strokeLineJoin 设置路径交界处的连接方式,取值为 miter,round,bevel.
  • android:strokeMiterLimit 设置斜角的上限,Sets the Miter limit for a stroked path.

位置改变动画

<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"    android:duration="1000"    android:repeatMode="reverse"    android:repeatCount="infinite"    android:propertyName="translateX"    android:valueFrom="10"    android:valueTo="0"    android:valueType="floatType"></objectAnimator>

颜色改变动画

<objectAnimator                  xmlns:android="http://schemas.android.com/apk/res/android"      android:duration="5000"      android:repeatMode="reverse"      android:repeatCount="infinite"      android:propertyName="fillColor"      android:valueFrom="@android:color/holo_red_dark"      android:valueTo="@android:color/holo_orange_dark"      android:valueType="intType"></objectAnimator>

轨迹绘制:

<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"                android:duration="5000"                android:repeatMode="reverse"                android:repeatCount="infinite"                android:propertyName="trimPathStart"                android:valueFrom="1"                android:valueTo="0"                android:valueType="floatType"></objectAnimator>
原创粉丝点击