开发者

Block the default animation for startActivity

开发者 https://www.devze.com 2023-02-10 20:03 出处:网络
Me started an activity like this Intent mainIntent = new Intent(v.getContext(), Second.class); startActivity(mainIntent);

Me started an activity like this

Intent mainIntent = new Intent(v.getContext(), Second.class);
startActivity(mainIntent);
overrideP开发者_JAVA百科endingTransition(android.R.anim.slide_out_right,
                        android.R.anim.slide_in_left);

I have set overridePendingTrasition for animation.

You can see i have set animation the oposite to the normal android startactivity animation. So now this two animation get collapsed each other.

I want block the default animation (left->right) for while we use start activity

Thank you


You can prevent the default animation by setting flag FLAG_ACTIVITY_NO_ANIMATION
like this

mainIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
0

精彩评论

暂无评论...
验证码 换一张
取 消