@Override
public void onBackPressed() {
super.onBackPressed();
overridePendingTransition(R.anim.activity_move_back2, R.anim.activity_move_back);
}
overridePendingTransition(R.anim.activity_move,
R.anim.activity_move2);
//activity_move_back.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="0"
android:toXDelta="480"
android:duration="300"
/>
</set>
//activity_move_back2.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="-480"
android:toXDelta="0"
android:duration="300"
/>
</set>
//activity_move.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="480"
android:toXDelta="0"
android:duration="300"
/>
</set>
//activity_move2.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="0"
android:toXDelta="-480"
android:duration="300"
/>
</set>