Skip to content Skip to sidebar Skip to footer

Hero Transitions Not Working Android Lollipop

I tried to make animations/transitions between activities but I couldn't make it perfect and good. And I couldn't find any helping guide. Can you tell me how to create an ActivityO

Solution 1:

You need two shared elements:

  1. The card (the entire card) from the list view will be shared and mapped to the root view of the detail view activity. You can transition that with a ChangeBounds.
  2. The ImageView from the list view will be shared and mapped to the ImageView in the detail view activity. You can use a TransitionSet with both ChangeBounds and ChangeImageTransform.

That means that your activity options will look something like this:

ActivityOptions.makeSceneTransition(YourActivity.this, Pair.create(yourCardViewInstance, "cardView"), Pair.create(yourImageViewInstance, "imageView")

Finally, make sure that the views in your second activity have transition names that match those in your ActivityOptions. E.g.

<FrameLayoutandroid:transitionName="cardView"><ImageViewandroid:transitionName="ImageView">
...

Post a Comment for "Hero Transitions Not Working Android Lollipop"