我正在尝试制作简单的动画,可以重复几次(或无限次)。
看起来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>
首先,它应该在500ms内将图像从1.0缩放到1.2大小。
然后在500毫秒内将其缩减到1.0。
下面是我是如何使用它的:
Animation firstAnimation = AnimationUtils.loadAnimation(this, R.anim.first_animation);
imgView.startAnimation(firstAnimation);
它做一个循环,然后结束。
它先是放大,然后缩小,然后停止。
如何才能使此功能按预期工作?
https://stackoverflow.com/questions/4480652
复制相似问题