0

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?

4

2 回答 2

0

You can create a listener for approach #1 using Otto. Basically, that is an event bus that provides a mechanism that you can use to communicate with different parts of your application.

于 2017-01-30T18:41:46.800 回答
0

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

于 2017-01-30T22:17:40.840 回答