5

I'm working with Lollipop transitions between two activities. I have a shared element which I animate with a transition to and from activities A and B. In activity B a keyboard pops up and resizes the window. The animation looks great when going into activity B. The problem is when returning back to activity A the shared element transition looks bad because the windows size is still based on what the keyboard resized it to (even though the keyboard minimizes automatically when going back to A and eventually the window is the correct size).

I have tried manually hiding the soft input before leaving activity B and calling finishAfterTransition. Unfortunately no luck! I have also tried postponing the shared element transition, but that also didn't work well. One solution would be to have a tiny delay (10ms) when the user presses back to finish activity B in order to give the window time to resize itself before leaving, but that feels hacky to me.

Any ideas greatly appreciated!

case12
  • 125
  • 9
  • How are you returning from activity `B` to activity `A`? For example, if the keyboard is open and you click the back button, shouldn't that dismiss the keyboard window first instead of returning to activity `A`? – Alex Lockwood Apr 28 '15 at 04:38
  • Yep, that is the case if you press the back button on the navigation bar. However, I have a button at the top that acts as an "Accept" button which will finish activity B and go back to A. – case12 Apr 28 '15 at 19:07
  • Hmm... in that case, the tiny delay like you mentioned might actually be the best solution. It feels hacky, but you definitely don't want to animate the keyboard out of view while the transition is playing or else the transition is going to look pretty crappy. I can't come up with any other ideas, at least... – Alex Lockwood Apr 28 '15 at 19:44

0 Answers0