What I am trying to achieve is : start a new activity with a transition animation for the exiting activity only.
I would like to slide up the current activity, where the new activity will be behind the current one.
Here is the slide up animation : R.layout.slide_up
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="1000"
android:fromYDelta="0%"
android:toYDelta="100%" />
</set>
Here is how I am applying the activity animation transition :
overridePendingTransition ( 0 , R.anim.slide_up );
I am using 0 for the entering activity since I do not want any animation for the new activity, and it is not working (the animation is not performed). If I use an animation for entering activity too, it works (both animations are performed), like such :
overridePendingTransition ( R.anim.slide_out , R.anim.slide_up );
where R.anim.slide_out :
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="1000"
android:fromYDelta="100%"
android:toYDelta="0%" />
</set>
Any ideas ?
I am working on Android 4.1.2 and Android 4.0.4
Android's transition framework allows you to animate all kinds of motion in your UI by simply providing the starting layout and the ending layout.
Alter your exit animation so that it renders over top of the entering activity.
R.anim.slide_up
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:zAdjustment="top">
<translate
android:duration="1000"
android:fromYDelta="0%"
android:toYDelta="100%" />
</set>
Then you can do what you were originally doing to set the animation.
overridePendingTransition ( 0 , R.anim.slide_up );
Call the below method after startActivity method.
overridePendingTransition(0,0);
This will override the default animation and do no animation. You can also give some custom animation if you like
overridePendingTransition(R.anim.animation1,R.anim.animation2);
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