开发者

Android - Leave A Time Between ImageButton Animations?

开发者 https://www.devze.com 2023-03-19 16:59 出处:网络
I have 6 ImageButton. I applied the same animation to all of them as below: Animation anim1 = AnimationUtils.loadAnimation(this, R.anim.wave_scale);

I have 6 ImageButton. I applied the same animation to all of them as below:

Animation anim1 = AnimationUtils.loadAnimation(this, R.anim.wave_scale);
img1.startAnimation(anim1);
img2.startAnimation(anim1);
img3.startAnimation(anim1);
img4.startAnimation(anim1);
im开发者_StackOverflowg5.startAnimation(anim1);
img6.startAnimation(anim1);

Now, I want to hav a free small time between one animation and the other (let's say 200 ms), so that they will not start at the same time. I tried to add this.wait(200) between each of the startAnimation methods but this didn't work.

Any solution ?


The temporary solution that I found until now is:

  1. You need to re-define the same animation for each ImageView. Strange !
  2. Before you assign it to an ImageView, you will setStartOffset() for your animation by whatever you want.

Wired But works fine !

Thanks.


try this: img1.setStartOffset(700); This will create a delay of 700 millsec before animation starts

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号