在结束之前重复android动画

在结束之前重复android动画,android,animation,repeat,Android,Animation,Repeat,我有一个基本的动画,可以使图片增长和褪色,语法如下: <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false"> <scale android:interpolator="@android:anim/linear_interpolat

我有一个基本的动画,可以使图片增长和褪色,语法如下:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false">

  <scale
   android:interpolator="@android:anim/linear_interpolator"
   android:fromXScale="1.0"
   android:toXScale="4.0"
   android:fromYScale="1.0"
   android:toYScale="4.0"
   android:pivotX="50%"
   android:pivotY="50%"
   android:fillAfter="true"
   android:duration="2500"
   android:repeatCount="infinite"
   android:repeatMode="restart" />
  <alpha    
   android:fromAlpha="1.0"    
   android:toAlpha="0.0"    
   android:duration="2500"
   android:repeatCount="infinite"
   android:repeatMode="restart"/>  

</set>
一切正常,但我想在动画结束前重复一遍。假设我想每秒重复动画,即使播放需要2.5秒


正确的方法是什么?

将动画文件名创建为progress\u animation.xml

<?xml version="1.0" encoding="utf-8"?>
  <animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false" >

    <item
        android:drawable="@drawable/animation_one"
        android:duration="350"/>
    <item
        android:drawable="@drawable/animation_two"
        android:duration="350"/>
     <item 
         android:drawable="@drawable/animation_three" 
        android:duration="350"/> 
    <item 
         android:drawable="@drawable/animation_four"
         android:duration="350"/> 

</animation-list>
<?xml version="1.0" encoding="utf-8"?>
  <animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false" >

    <item
        android:drawable="@drawable/animation_one"
        android:duration="350"/>
    <item
        android:drawable="@drawable/animation_two"
        android:duration="350"/>
     <item 
         android:drawable="@drawable/animation_three" 
        android:duration="350"/> 
    <item 
         android:drawable="@drawable/animation_four"
         android:duration="350"/> 

</animation-list>
ImageView ivProgress = (ImageView) this.findViewById(R.id.iv_progress);

    // Set the background of the image - In this case an animation
    // (/res/anim folder)
    ivProgress.setBackgroundResource(R.anim.progress_animation);

    // Get the image background and attach the AnimationDrawable to it.
    progressAnimation = (AnimationDrawable) ivProgress.getBackground();
    progressAniation.start();