本文介绍了自定义后退按钮动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
默认的动画时,返回
按钮是pressed是从左至右滑动。我想替换一个自定义动画。我目前认为的某种组合 onBack pressed()
和 overridePendingTransition
会做的伎俩,但我一直没能得到它的工作。
The default animation when the Back
button is pressed is a slide from left to right. I'd like to replace that with a custom animation. I'm currently thinking that some combination of onBackPressed()
and overridePendingTransition
will do the trick, but I haven't been able to get it working.
推荐答案
我觉得你不应该使用结束(),因为在浏览存储的数据将被删除
I think you shouldn't use finish() because the data stored by the Views will be erased
@Override
public void onBackPressed() {
super.onBackPressed();
overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);
}
这篇关于自定义后退按钮动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!