【问题标题】:How do you pause and restart an animations in Android?如何在 Android 中暂停和重新启动动画?
【发布时间】:2011-08-16 04:25:06
【问题描述】:

我想知道如何暂停和重新启动动画。我遵循了这段代码,但它对我不起作用:

animRight = AnimationUtils.loadAnimation(this, R.anim.move_right1);
            animRight.setDuration(3000);
            mTv1.setVisibility(TextView.VISIBLE);
            mTv1.setBackgroundResource(R.drawable.hand);
            animRight.setAnimationListener(this);
            mTv1.startAnimation(animRight);

// override methods 

    @Override
    public void onAnimationEnd(Animation animation) {
// when animations is finished 
 }

    @Override
    public void onAnimationStart(Animation animation) {
// when animations is start
 }

    @Override
    public void onAnimationRepeat(Animation animation) {
// when animations is repeated  
 }

在这里我想暂停并重新开始动画。我该怎么做?

【问题讨论】:

    标签: android android-layout android-animation


    【解决方案1】:

    动画没有暂停方法

    来自 API:Package android.view.animation

    go about this的方式上查看评论。

    【讨论】:

      【解决方案2】:

      没有暂停方法。你可以去实现postDelayed。

      【讨论】:

      • 我知道动画中没有暂停方法,有没有其他方法可以实现暂停和重启
      猜你喜欢
      • 1970-01-01
      • 2015-06-18
      • 2020-04-26
      • 1970-01-01
      • 2013-10-25
      • 1970-01-01
      • 1970-01-01
      • 2020-04-09
      相关资源
      最近更新 更多