I am trying to slide an Activity from Bottom to Top which I am able to do.
But while sliding from bottom to top my background activity is also sliding to bottom. I want
You can simply call overridePendingTransition(R.anim.slide_in_up, 0)
0
means no animation.
slide_up.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_decelerate_interpolator">
<translate
android:duration="@android:integer/config_longAnimTime"
android:fromYDelta="100%p"
android:toYDelta="0" />
</set>
slide_down.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_decelerate_interpolator">
<translate
android:duration="@android:integer/config_longAnimTime"
android:fromYDelta="0"
android:toYDelta="100%p" />
</set>
stay.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:fromYDelta="0%p"
android:toYDelta="0%p" />
Open Activity
startActivity(new Intent(FromActivity.this, ToActivity.class));
overridePendingTransition(R.anim.slide_up, R.anim.stay);
Close Activity
finish();
overridePendingTransition(R.anim.stay, R.anim.slide_down);
Then provide an outgoing animation to make the current Activity stay still:
overridePendingTransition(R.anim.slide_in_up, R.anim.stay);
stay.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:fromYDelta="0%p"
android:toYDelta="0%p" />