如何反转正在运行的动画?

时间:2016-09-07 13:52:39

标签: android animation

触摸Button时,会启动缩放动画。

Animation zoomIn = AnimationUtils.loadAnimation(context, R.anim.zoomin);
view.startAnimation(zoomIn);

zoomin.xml 代码:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillEnabled="true"
    android:fillAfter="true">
    <scale
        android:fromXScale="1.0"
        android:toXScale="1.3"
        android:fromYScale="1.0"
        android:toYScale="1.3"
        android:pivotX="50%"
        android:pivotY="50%"
        android:duration="200"
        android:interpolator="@android:anim/accelerate_interpolator"/>
</set>

但是如果在这个仍在运行的动画中释放Button,它应该从此时间点反转动画。

我如何实现这一目标?

1 个答案:

答案 0 :(得分:1)

您可以使用clean all files in the checkout directory before the build来实现这样的目标。

例如:

ViewPropertyAnimator