我正在尝试制作可以重复几次(或无限次)的简单动画。
似乎 android:repeatCount
不工作!
这是我从 /res/anim/first_animation.xml
得到的动画资源:
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"
android:repeatCount="infinite"
>
<scale
android:interpolator="@android:anim/decelerate_interpolator"
android:duration="500"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:toXScale="1.2"
android:toYScale="1.2"
android:pivotX="50%"
android:pivotY="50%"
android:fillAfter="false" />
<scale
android:interpolator="@android:anim/accelerate_interpolator"
android:startOffset="500"
android:duration="500"
android:fromXScale="1.2"
android:fromYScale="1.2"
android:toXScale="1.0"
android:toYScale="1.0"
android:pivotX="50%"
android:pivotY="50%"
android:fillAfter="false" />
</set>
首先,它应该缩放图像从1.0到1.2大小在500毫秒。
然后在500毫秒内缩小到1.0。
我是这样使用它的: < br/>
Animation firstAnimation = AnimationUtils.loadAnimation(this, R.anim.first_animation);
imgView.startAnimation(firstAnimation);
它做一个周期,然后完成。
它向上扩展,然后向下扩展,然后停止。
我怎样才能使这个工作按计划进行?