安卓监听帧动画结束

问题描述:帧动画连续播放--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是第一个动画播放的总时间

posted @ 2015-01-19 14:41  伟大的臭猪猪  阅读(2438)  评论(0编辑  收藏  举报