问题描述:帧动画连续播放--android 帧动画没有提供结束动作的监听方法,怎么实现播放完一个动画之后接着播放第二个动画呢?

 

 

正确方法1:

 

 

public void mmswoon(){ 

        imageView.setBackgroundResource(R.anim.mmswoon); 

        AnimationDrawable animationDrawable = (AnimationDrawable)imageView.getBackground(); 

        animationDrawable.start(); 

         

        int duration = 0; 

        for(int i=0;i<animationDrawable.getNumberOfFrames();i++){ 

            duration += animationDrawable.getDuration(i); 

        } 

        Handler handler = new Handler(); 

        handler.postDelayed(new Runnable() { 

            public void run() { 

               //此处调用第二个动画播放方法   

            } 

        }, duration); 

         

    } 

duration是第一个动画播放的总时间

相关文章:

  • 2019-03-30
  • 2021-09-25
  • 2022-12-23
  • 2022-12-23
  • 2022-01-21
  • 2021-10-21
  • 2021-09-16
  • 2022-12-23
猜你喜欢
  • 2021-07-05
  • 2021-05-09
  • 2022-12-23
  • 2022-12-23
  • 2021-04-24
  • 2022-12-23
  • 2021-04-19
相关资源
相似解决方案