Android - 如何在活动更改之间停止动画 [英] Android - How to stop animation between activity changes

查看:24
本文介绍了Android - 如何在活动更改之间停止动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用中有多个不同的 Activity,并且在 Activity 之间切换时我不想要任何过渡动画.以下是我在活动之间的变化:

I have multiple different Activity in my app and I don't want any transition animation when changing between Activities. Below is the how I'm changing between Activities:

Intent i = new Intent(FirstActivity.this, SecondActivity.class);
            i.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
            startActivity(i);

这在我第一次开始新活动时效果很好.没有动画,但是当我回到已经启动的 Activity 时,似乎忽略了Intent.FLAG_ACTIVITY_NO_ANIMATION"并且发生了默认动画.

This works great the first time I start a new Activity. There is no animation, but when I go back to an Activity that is already started it seems like the "Intent.FLAG_ACTIVITY_NO_ANIMATION" is ignored and the default animation happens.

我似乎无法弄清楚为什么会这样.

I can't seem to figure out why this is happening.

推荐答案

你试过 overridePendingTransition()?

这篇关于Android - 如何在活动更改之间停止动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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