当前位置: 代码迷 >> Android >> android判断卡通已结束
  详细解决方案

android判断卡通已结束

热度:91   发布时间:2016-04-28 03:58:36.0
android判断动画已结束

添加一个动画效果 ?

发现动画没执行完 ?就直接跳转或者finish掉

?

添加动画监听事件即可,代码如下:
  1. player.startAnimation(anim);??
  2. anim.setAnimationListener(new?AnimationListener()?{??
  3. ??????
  4. ????@Override??
  5. ????public?void?onAnimationStart(Animation?animation)?{??
  6. ????????//?TODO?Auto-generated?method?stub ??
  7. ??????????
  8. ????}??
  9. ??????
  10. ????@Override??
  11. ????public?void?onAnimationRepeat(Animation?animation)?{??
  12. ????????//?TODO?Auto-generated?method?stub ??
  13. ??????????
  14. ????}??
  15. ??????
  16. ????@Override??
  17. ????public?void?onAnimationEnd(Animation?animation)?{??
  18. ????????//?TODO?Auto-generated?method?stub ??
  19. ????????finish();??
  20. ????}??
  21. });??
  22. ??
  23. overridePendingTransition(android.R.anim.fade_in,android.R.anim.fade_out);??
				player.startAnimation(anim);				anim.setAnimationListener(new AnimationListener() {										@Override					public void onAnimationStart(Animation animation) {						// TODO Auto-generated method stub											}										@Override					public void onAnimationRepeat(Animation animation) {						// TODO Auto-generated method stub											}										@Override					public void onAnimationEnd(Animation animation) {						// TODO Auto-generated method stub						finish();					}				});								overridePendingTransition(android.R.anim.fade_in,android.R.anim.fade_out);

?

?

?

在onAnimationEnd ? ?添加自己想要的动作就行 ?

  相关解决方案