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 to keep background activity to same position as it was, so that the new activity will seem as a overlay to background activity when open.
Here are my slide_in_up.xml
<?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromYDelta="100%p" android:toYDelta="0%p" android:duration="@android:integer/config_longAnimTime"/>
and slide_out_up.xml
<?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromYDelta="0%p" android:toYDelta="100%p" android:duration="@android:integer/config_longAnimTime"/>
How can I do that?
Thanks...
However, activity can't be run unless it's on foreground. In order to achieve what you want, in onPause(), you should start a service to continue the work in activity.
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With