android 相邻两个activity跳转的时候动画设置

来源:互联网 发布:华为 acl 端口 编辑:程序博客网 时间:2024/06/05 23:59

activity跳转到新activity的时候默认会迅速一闪而过,给用户视觉上带来不好的体验.我们通过代码设置可以把这样的情况屏蔽掉.

Intent intent = new Intent(this.second.class);startActivity(intent);finish();overridePendingTransition(0, 0);//取消过渡动画//位移动画    overridePendingTransition(R.anim.activity_in_animation,R.anim.activity_out_animation);// in_animation<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android">    <translate        android:fromXDelta="100%"        android:toXDelta="0%"        android:duration="300" /></set>// out_animation<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android">    <translate        android:fromXDelta="0%"        android:toXDelta="-100%"        android:duration="300" /></set>
0 0
原创粉丝点击