androidslideandroid-transitionsactivity-transition

Views are transitioning individually/separately when using Activity Transitions


I'm trying to create a slide up effect for one of my Android Applications' Activity, similar to the Gmail app's compose Activity enter animation/transition, without the previous Activities' exit animation though. As per my research, there are two ways to achieve this:

  1. overridePendingTransition(R.anim.slide_in_bottom, R.anim.stay) after startActivity() in Activity A and overridePendingTransition(R.anim.stay, R.anim.slide_out_bottom) after finish() in Activity B. Problem with this approach: I need to set listeners for the enter animation/transition in Activity B in order to perform further animations and I do not want to use some kind of guessed delay in onCreate(). Other than that, this approach works flawlessly.

  2. Using the "new" (not really anymore) Activity Transitions API to perform a android.transition.Slide for both the enter and exit transitions of Activity B with the slide edge set to bottom. Problem with this approach: This weird seperation / individual transitioning of views is introduced when using this approach. (Not pasting any code here as it's not necessary, I'm using the Slide from a transitionSet in xml or the default constructor in code)

So my question is, is there a way to have an actual listener for approach 1 I don't know of or is there a way to eliminate that weird separation with approach 2 and if yes, how?


Solution

  • Put the views that should be animated together in a "Transition Group".