禁用活动幻灯片的动画时,推出新的活动? [英] Disable activity slide-in animation when launching new activity?

查看:123
本文介绍了禁用活动幻灯片的动画时,推出新的活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这将启动另一个活动,通过点击一个按钮的活动。默认情况下,在Android上的较新版本的操作系统,该操作系统将动画的新活动由右至左滑动。

I have an activity which launches another activity, via a button click. By default, on newer OS versions of android, the OS will animate the new activity sliding in from right to left.

有没有一种方法来禁用此动画?我只是希望出现新的活动没有任何类型的动画。

Is there a way to disable this animation? I just want the new activity to appear without any sort of animation.

推荐答案

FLAG_ACTIVITY_NO_ANIMATION 标记正常工作启动活动时,禁用动画。

The FLAG_ACTIVITY_NO_ANIMATION flag works fine for disabling the animation when starting activities.

要禁用呼叫时所触发的类似的动画完成()的一个活动,即从右侧的动画幻灯片向左相反,你可以叫 overridePendingTransition(0,0)呼叫后完成()和下一个动画将被排除在外。

To disable the similar animation that is triggered when calling finish() on an Activity, i.e the animation slides from right to left instead, you can call overridePendingTransition(0, 0) after calling finish() and the next animation will be excluded.

这也适用于如果调用的动画 overridePendingTransition(0,0)呼叫后 startActivity(...)

This also works on the in-animation if you call overridePendingTransition(0, 0) after calling startActivity(...).

这篇关于禁用活动幻灯片的动画时,推出新的活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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