gpt4 book ai didi

android - 如何打开没有动画的Android Activity

转载 作者:太空宇宙 更新时间:2023-11-03 11:43:47 25 4
gpt4 key购买 nike

我编写了一个 Android 应用程序,一切正常,除了一件事:当我从一个 Activity 切换到另一个 Activity 时,它会制作这个“Activity 打开”动画,你知道,当它像一个新应用程序一样打开时。没有那个动画,有没有办法打开一个 Activity ?谢谢

最佳答案

您可以尝试将 Flag 与您的 Intent 一起使用,如下所示:

Intent intent = new Intent(Activity1.this, Activity2.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(intent);

但请记住:

If set in an Intent passed to Context.startActivity(), this flag will prevent the system from applying an activity transition animation to go to the next activity state. This doesn't mean an animation will never run -- if another activity change happens that doesn't specify this flag before the activity started here is displayed, then that transition will be used. This flag can be put to good use when you are going to do a series of activity operations but the animation seen by the user shouldn't be driven by the first activity change but rather a later one.

或者你可以定义一个custom animation in your style@android:style/Animation.Activity 父级作为 @null 参数用于您不想要的动画。

关于android - 如何打开没有动画的Android Activity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23454472/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com