qrobot开发总结之 Animation 帧动画监听结束的方法
2011-11-21 18:34
411 查看
这个问题用中文搜了很久一直没有解决,今天尝试用英文在Google上搜了一下,打开第一个网页就把困扰的很久的问题解决了
问题描述:帧动画连续播放--android 帧动画没有提供结束动作的监听方法,怎么实现播放完一个动画之后接着播放第二个动画呢?
正确方法1:
PS :自己试过了,可以实现效果
正确方法2:
问题描述:帧动画连续播放--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是第一个动画播放的总时间
PS :自己试过了,可以实现效果
正确方法2:
this.q_pic_view.setImageResource(0); this.q_pic_view.setBackgroundResource(R.drawable.animation_test); AnimationDrawable correct_animation = (AnimationDrawable) this.q_pic_view.getBackground(); correct_animation.start(); //here I tried to implement option C but it didn't work while(correct_animation.isRunning()){ try { Thread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }这个方法没有试过
相关文章推荐
- Android Animation 帧动画监听结束的方法
- iOS开发--动画(Animation)总结
- 关于Android动画的监听,开始,结束的控制分别有 Animation 动画和 ObjectAnimator 动画
- Animation动画开始、结束、重复事件监听
- AnimationDrawable监听播放结束及ImageSwitcher动画图片切换,带动画
- Android开发——Home键监听方法总结
- 【IOS功能实现】之Core Animation动画开发总结(CALayer)
- 监听css3动画结束事件-webkitAnimationEnd
- 【移动开发】Android Animation 动画效果总结
- iOS开发动画(Animation)总结
- CABasicAnimation CAAnimationGroup等动画结束后避免回到初始状态的设置方法
- Android开发之Button事件实现与监听方法总结
- android开发动画总结一(tweened animation)
- iOS开发动画(Animation)总结
- iOS开发动画总结(Animation)
- iOS开发动画(Animation)总结
- Android动画开发——Animation动画效果
- 微信小程序开发animation心跳动画
- .NET开发中你可能会用到的常用方法总结
- iPhone/iOS Core Animation开发总结