在我的Activity
过渡幻灯片中,幻灯片输入/输出动画从左到右从右向后移动,例如当前动画就像这张图片一样:
但是我想在从左到右打开活动后,从右边出来,不是从左到左,就像这张图片一样:
遗憾的是,我无法在onBackPressed()
ActivityMain:
Intent i = new Intent(ActivityMain.this, ActivityRobotAssistant.class);
startActivity(i);
overridePendingTransition(R.anim.pull_in_left, R.anim.push_out_right);
ActivitySecond:
public void onBackPressed() {
super.onBackPressed();
overridePendingTransition(R.anim.pull_in_right, R.anim.push_out_left);
}
pull_in_left.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="300"
android:fromXDelta="-100%"
android:toXDelta="0%"
android:interpolator="@android:anim/decelerate_interpolator"
/>
pull_in_right.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="300"
android:fromXDelta="100%"
android:toXDelta="0%"
android:interpolator="@android:anim/decelerate_interpolator"
/>
push_out_left.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="300"
android:fromXDelta="0%"
android:interpolator="@android:anim/decelerate_interpolator"
android:toXDelta="-100%" />
push_out_right.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="300"
android:fromXDelta="0%"
android:interpolator="@android:anim/decelerate_interpolator"
android:toXDelta="100%" />