禁用活动之间的过渡动​​画 [英] Disable Transition Animation Between Activities

查看:174
本文介绍了禁用活动之间的过渡动​​画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从活动A调用活动B,其中包含使用以下代码的视频视图:

I am calling an Activity B from Activity A, which contains a Video View using the following code :

Intent intent = new Intent(this, B.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivityForResult(intent, 0);

我使用 Intent.FLAG_ACTIVITY_NO_ANIMATION 以避免在调用新活动时转换动画。但它不适合我和黑屏在转型期间即将到来。有没有办法避免这种过渡动画和黑屏,以便用户不会知道在新屏幕中调用视频视图?

I am using Intent.FLAG_ACTIVITY_NO_ANIMATION to avoid transition animation while new activity is being called. But its not working for me and a black screen is coming while the transition. Is there any way to avoid this transition animation and black screen, so that the user will not come to know that the video view is being called in a new screen?

推荐答案

如果你想为所有活动做这件事,那么就这样做:

if you want to do it for all activities then do it in this way:

切换没有动画的活动

只需为清单中的每个活动分配没有动画的样式。

Just assign style with no animation to each activity in manifest.

或通过代码以这种方式执行:

Or through code do it in this way:

启动时禁用活动幻灯片动画新活动?

这篇关于禁用活动之间的过渡动​​画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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