Android的,如何开始一个新的活动时,禁用“擦”的效果? [英] Android, how to disable the 'wipe' effect when starting a new activity?

查看:165
本文介绍了Android的,如何开始一个新的活动时,禁用“擦”的效果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序,我怎么禁用过渡动画,显示从右边和旧的出口新的活动布局进入到左?

In my application, how do I disable the transition animation that shows the new activity layout enter from the right and the old one exit to left?

版本2.0 - > 2.2如果相关

Versions 2.0 -> 2.2 if relevant.

推荐答案

CaseyB反应良好,我们可以设置动画

CaseyB response is good we can set an animation

getWindow().setWindowAnimations(int);

但由于Android SDK 2.0,你会使用 overridePendingTransition(),以改变过渡动画,这是一个例子从闪屏加载我的应用程序。

but since Android SDK 2.0 you will use overridePendingTransition(), to change the transition animation, this is an example loading my App from the SplashScreen.

      @Override
      public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.SplashScreen);

              new Handler().postDelayed(new Runnable() {
                      @Override
                      public void run() {
                              Intent mainIntent = new Intent(SplashScreen.this,     AndroidNews.class);
                              SplashScreen.this.startActivity(mainIntent);
                              SplashScreen.this.finish();

                              overridePendingTransition(R.anim.mainfadein,
                                      R.anim.splashfadeout);
                      }
              }, 3000);
      }

}

这篇关于Android的,如何开始一个新的活动时,禁用“擦”的效果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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