1

I am new to android programming What I am trying to do is scale the buttons one by one across my row. But what is happening is they all scale at the same time.

   for(int xcnt = 1; xcnt < 9;  ){

   RelativeLayout box = (RelativeLayout) buttonBoxes.get(xcnt);

   Animation animscale =   new ScaleAnimation(1f, 1.5f, 1f, 1.5f,
                Animation.RELATIVE_TO_SELF, (float)0.5, 
                Animation.RELATIVE_TO_SELF, (float)0.5);            

    animscale.setDuration(2000);
    animscale.setStartOffset(1000);  // pause for 1 second
    animscale.setRepeatMode(ValueAnimator.REVERSE);

        box.startAnimation(animscale);

        animscale.setStartOffset(1000);  // pause for 1 second
        xcnt = xcnt +1;

    }

1 Answers1

0

Issue is that the for loop (index 1 to 9) will be executed with in some micro seconds . All the animation will be started immediately with a micro seconds of delay . Settings setStartOffset as 1000ms doesn't make a big change visually.

Try changing the offset time as xcnt * 1000

 animscale.setStartOffset(1000 * xcnt);
Libin
  • 16,967
  • 7
  • 61
  • 83