我有这将启动另一个活动,通过点击一个按钮的活动。默认情况下,在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(...)
.
相关推荐
最新文章