android判断动画已结束
程序员文章站
2022-03-17 13:16:02
...
添加一个动画效果
发现动画没执行完 就直接跳转或者finish掉
- 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);
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 添加自己想要的动作就行