【发布时间】:2018-05-15 12:18:11
【问题描述】:
我一直在使用 xml 中的 animated-vector 来为我的一些向量设置动画,方法是使用 trimPathEnd 等,例如:
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/vectordrawable" >
<target android:name="main_path">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="1000"
android:interpolator="@android:interpolator/fast_out_linear_in"
android:propertyName="trimPathEnd"
android:valueFrom="0"
android:valueTo="1"/>
</aapt:attr>
</target>
</animated-vector>
但是我想知道是否可以在不使用动画的情况下进行 trimPathEnd 或 trimPathStart,这是因为我想实现一个布局,其中基于屏幕触摸偏移量绘制矢量,所以我猜想像vector.setTrimPathEnd(0.2f); 这样我需要根据特定的偏移量动态更改Java 中的路径结束。我能找到的所有信息都是通过animated-vector 完成此操作,这不是我需要的行为。
【问题讨论】:
-
欢迎投反对票以添加评论,也许我遗漏了什么。
标签: java android android-vectordrawable animatedvectordrawable