Disable Transition Animation Between Activities

2019-03-14 08:37发布

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);

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?

2条回答
Anthone
2楼-- · 2019-03-14 09:00

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

switching activities without animation

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

Or through code do it in this way:

Disable activity slide-in animation when launching new activity?

查看更多
欢心
3楼-- · 2019-03-14 09:07

Try calling:

Intent intent = new Intent(this, B.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivityForResult(intent, 0);
overridePendingTransition(0,0); //0 for no animation
查看更多
登录 后发表回答