如何为旋转动画创建暂停

时间:2013-03-27 01:11:36

标签: android animation android-animation android-spinner

我需要知道如何暂停旋转动画:

public void onClick(View v)
{
   ImageView animationTarget = (ImageView) this.findViewById(R.id.ImgWheel);

   switch (v.getId())
   {
      case R.id.playButton:

      playBtn.setVisibility(Button.INVISIBLE);
      pauseBtn.setVisibility(Button.VISIBLE);
      Animation animation = AnimationUtils.loadAnimation(this, R.anim.rotate_around_center_point);
      animationTarget.startAnimation(animation);
      break;

      case R.id.pauseButton:

      pauseBtn.setVisibility(Button.INVISIBLE);
      playBtn.setVisibility(Button.VISIBLE);

      //here is where i may put the pause button codes//

      break;
   }
}

2 个答案:

答案 0 :(得分:0)

使用animationTarget.clearAnimation()尝试帮助

答案 1 :(得分:0)

public void pauseAnimation(View view) {
anim.pause();
//you need to define anim