First of all, you have
CollapsingToolbarLayout , with its usual properties. With its
app: properties we position and style the collapsed/expanded text to our taste. That was already part of our setup before.
The first widget inside the layout is a
Space. The size of the largest widget inside the
CollapsingToolbarLayout dictates its expanded size. That’s what I use this layout for.
The next layout in order is the Toolbar itself. It contains some extra properties to put the text at the correct place (left and right margins), this layout can also be used to put some extra widgets inside, like a cast button on the right.
The next view is a clickable layout, with the chevron in it. We will try to position this layout exactly where the text is, changing its size and height while collapsing. The chevron inside is just a regular ImageView which we will rotate on the click action.
Finally, we have a back button touch forwarder, positioned exactly above the back button. See why this is required in the following section.