Ich versuche, eine einfache Animation zu erstellen, die sich mehrmals (oder unendlich) wiederholt.
Es scheint, dass android:repeatCountdas nicht funktioniert!
Hier ist meine Animationsressource von /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>
Zuerst sollte das Bild in 500 ms von 1,0 auf 1,2 skaliert werden.
Und skalieren Sie es dann in 500 ms auf 1,0 zurück.
So benutze ich es:
Animation firstAnimation = AnimationUtils.loadAnimation(this, R.anim.first_animation);
imgView.startAnimation(firstAnimation);
Es macht einen Zyklus und endet dann.
Es skaliert nach oben, dann nach unten und stoppt dann.
Wie kann ich diese Arbeit wie beabsichtigt machen?