Je suis en train de faire une animation simple qui est répétée plusieurs fois (ou infini).
Il semble qu' android:repeatCount
ne fonctionne pas!
Voici mon animation des ressources d' /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>
D'abord, il doit adapter l'image à partir de 1.0 à 1.2 taille de 500 ms.
Et puis à l'échelle de retour à 1,0 dans les 500 ms.
Voici comment je l'utilise:
Animation firstAnimation = AnimationUtils.loadAnimation(this, R.anim.first_animation);
imgView.startAnimation(firstAnimation);
Il fait un cycle, puis de finitions.
Il évolue ensuite échelles sna, puis s'arrête.
Comment puis-je faire ce travail comme prévu?