I\'m doing some rudimentary exploration of Shared Element Transitions in Android L. The simple example I\'ve setup has an image view translating from the top of the screen t
As I recall, there is a bug in L that causes the shared element return transition to be interrupted if it takes longer than the reenter transition duration. If you adjust your reenter transition duration (on the calling Activity), that should fix the interruption problem until the bug is fixed in MR1.
The exit and reenter transitions are for executing stuff before the shared element is allowed to transition. For example, if you want to lift your shared element before transferring it, that would be done in the shared element exit transition. The reenter would be used to do the opposite -- drop the view after it was transferred back. Most apps don't need it, but it is there for the rare one that does.
You shouldn't call finishAfterTransition()
in onBackPressed()
. The Activity
super class will already do this for you.
You should call requestFeature()
before super.onCreate()
. Requesting Window.FEATURE_ACTIVITY_TRANSITIONS
is not necessary if you are using the Theme.Material
theme (or similar).
Calling setAllowEnterTransitionOverlap(false)
and setAllowReturnTransitionOverlap(false)
is redundant here. These determine the activity's window content transitions overlap... they don't affect the activity's shared element content transitions at all.
Setting exit and reenter shared element transitions is rarely necessary. You almost always want to use enter and return transitions instead. If you set only the exit and reenter shared element transitions and leave the enter and return shared element transitions null, the called activity will have no way of knowing how to animate the shared elements when the transition begins, and the animation will appear to be broken.