Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CollapsingToolbarLayout title as a shared element transition

I have a TextView in my activity A. How can I make shared element transition of TextView from activity A and a title of CollapsingToolbarLayout.setTitle() from activity B?

Is there way to obtain its title view id from CollapsingToolbarLayout's source code?

Thanks for help!

like image 827
Augusent Avatar asked Sep 13 '15 09:09

Augusent


1 Answers

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.

like image 149
Bartando Avatar answered Sep 28 '22 10:09

Bartando