Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make new activity appear behind old one during transition

What I'm trying to achieve is to override the start activity animation.

The animation should give the impression that the old activity is on top of the new activity, and then slides down and out of the screen to reveal the new activity. I've tried multiple ways such as using overridePendingTransition(startAnim, exitAnim) But the problem is they both animate in the same timeline. So overridePendingTransition(R.anim.hold, R.anim.exit_slide_down); You never see the exit animation because the new activity is on top. Can this be achieved using the framework?

enter image description here

like image 852
johncc Avatar asked Feb 15 '12 13:02

johncc


People also ask

What is activity transition?

Activity transitions in material design apps provide visual connections between different states through motion and transformations between common elements. You can specify custom animations for enter and exit transitions and for transitions of shared elements between activities.

Which of the following transitions is a shared elements transition?

Customizing Shared Elements Transition In Android L, shared elements transition defaults to a combination of ChangeBounds, ChangeTransform, ChangeImageTransform, and ChangeClipBounds. This works well for most typical cases. However, you may customize this behavior or even define your own custom transition.

What is transition animation in Android?

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.


1 Answers

Actually, I've found a property called android:zAdjustment in the animation files.

If I put android:zAdjustment="bottom" in hold.xml (screen 2) and android:zAdjustment="top" in push_down_out.xml (screen 1) then I can get the desired effect.

This gets around the z order issue (I assumed it was an issue with animation timings so I was barking up the wrong tree).

John

like image 157
johncc Avatar answered Nov 10 '22 05:11

johncc