How to move image up and down continuously using translate animation in android?

后端 未结 4 755
-上瘾入骨i
-上瘾入骨i 2020-12-08 08:05

I have successfully done one side animation using Translate Animation means the image goes from top to the bottom. Here is the code:

private Ima         


        
4条回答
  •  Happy的楠姐
    2020-12-08 08:19

    You need to set the repeat property

    android:repeatMode

    int. How an animation behaves when it reaches the end of the animation. android:repeatCount must be set to a positive integer or "-1" for this attribute to have an effect. Set to "reverse" to have the animation reverse direction with each iteration or "repeat" to have the animation loop from the beginning each time.

    Animation a;
    a.setRepeatMode(Animation.REVERSE);
    

提交回复
热议问题