0

我正在创建一个轮子旋转动画,它会在我运行应用程序时自动运行...我希望它旋转 90 度并暂停一段时间,然后再次旋转 90 度直到达到 360%...这是我的代码::

public void Start(){
    RotateAnimation counterSpinW = new RotateAnimation(0f, 90f, 50,50);
    counterSpinW.setRepeatMode(1);
    counterSpinW.getFillAfter();
    counterSpinW.setDuration(8000);

    counterSpinW.setInterpolator(new LinearInterpolator());
   bigLayout.startAnimation(counterSpinW);

   RotateAnimation counterSpinW2 = new RotateAnimation(0f, 90f, 50,50);
   counterSpinW2.setRepeatMode(1);
   counterSpinW2.getFillAfter();
   counterSpinW2.setDuration(8000);
   counterSpinW2.setInterpolator(new LinearInterpolator());
  bigLayout.startAnimation(counterSpinW2);

  RotateAnimation counterSpinW3 = new RotateAnimation(0f, 90f, 50,50);
  counterSpinW3.setRepeatMode(1);
  counterSpinW3.getFillAfter();
  counterSpinW3.setDuration(8000);
  counterSpinW3.setInterpolator(new LinearInterpolator());
 bigLayout.startAnimation(counterSpinW3);

 RotateAnimation counterSpinW4 = new RotateAnimation(0f, 90f, 50,50);
 counterSpinW4.setRepeatMode(-1);
 counterSpinW4.getFillAfter();
 counterSpinW4.setDuration(8000);
 counterSpinW4.setInterpolator(new LinearInterpolator());
bigLayout.startAnimation(counterSpinW4);

我想也许这行不通..但我还没有测试过....

4

1 回答 1

0

you should use setStartOffset()

firstRotateAnimation.setStartOffset(0);
pauseAnimation.setStartOffset(8000);
newRotateAnimation.setStartOffset(16000);
于 2013-04-04T23:30:50.833 回答