CollapsingToolbarLayout title as a shared element transition CollapsingToolbarLayout title as a shared element transition android android

CollapsingToolbarLayout title as a shared element transition


I've had similar issue. My app had CollapsingToolbar which had image in it and I wanted to share the image which was going from normal ListView into the CollapsingToolbar.

You need to create a custom TextView and use it as a replacement of the actual title in CollapsingToolbar. Also need to set the actual title to empty string so it looks hidden.

You should look into this answer where its shown how to use custom view in CollapsingToolbar with the listener which is needed to replicate animations of normal title. It may not look identical but I can't think of better idea. Hope it was helpful.


You can just use the collapsing tool bar as the target of the animation and it looks ok, but also animates the back button or drawer indicator which may not be what you want.