自定义后退按钮动画 [英] Custom Back Button Animation

查看:99
本文介绍了自定义后退按钮动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认的动画时,返回按钮是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);
}

这篇关于自定义后退按钮动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆