Intent intent = new Intent(this);
intent.setclass(this,Activity1.class)
startAcitivity(intent);
overridePendingTransition(R.anim.fade, R.anim.hold);//在跳转的语句后加上这条语句。
添加动画xml文件:
anim/fade.xml
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_longAnimTime"
android:fromAlpha="0.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:toAlpha="1.0" >
</alpha>
anim/hold.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_longAnimTime"
android:fromXDelta="0"
android:interpolator="@android:anim/accelerate_interpolator"
android:toXDelta="0" >
</translate>