Hiccups in activity transitions with shared elements

倖福魔咒の 提交于 2019-11-29 02:22:14
George Mount

It is possible that you are hitting a bug in the transitions library that, for some reason, wasn't discovered until after L was locked down.

In the bug, you must have a reenter transition and a shared element reenter transition. The default reenter transition is the same as the exit transition for both.

If, during the return transition, the shared element is transferred back to the calling Activity while the views are still entering, you will see a hiccup when it interrupts the return call. With the slide and explode transitions, you will also see that the next time you exit, they will start from where the hiccup happened, so you get a nice double-wammy.

So you have a few options to work around this bug until MR1:

  • Explicitly set the android:windowSharedElementReenterTransition to @null. Most of the time you don't need a shared element reenter transition because the called Activity will place the shared element in the right location for you.
  • Don't use an exit transition (set android:windowReenterTransition to @null)
  • Make sure the duration of the calling Activity's android:windowSharedElementReturnTransition is large enough so that the calling Activity's windowReenterTransition finishes first. This can be tricky because it can depend on device state -- the calling Activity may have been removed from memory and need to be restarted.
  • Set android:windowAllowReturnTransitionOverlap to false.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!