Skip to content Skip to sidebar Skip to footer

How To Make A Collapsing Toolbar In Android?

so im trying to implement a simple collapsing toolbar, but I don't think my xml layout is correct. The text is appearing the image and when I scroll down, I can't scroll back up to

Solution 1:

Your ImageView should have attribute called

app:layout_collapseMode="parallax"

If you want to add Toolbar to your Layout there should be attribute called

app:layout_collapseMode="pin"

And finally You missed one attribute for NestedScrollView.

app:layout_behavior="@string/appbar_scrolling_view_behavior"

Solution 2:

in your ImageView, add the following attribute:

app:layout_collapseMode="parallax"

Also, in your NestedScrollView tag, add the following:

app:layout_behavior="@string/appbar_scrolling_view_behavior"

Post a Comment for "How To Make A Collapsing Toolbar In Android?"