mKosut
mKosut

Reputation: 77

Android: How to change views in collapsing toolbar when scrolling

I am using collapsing toolbar. Is it somehow possible to achieve behavior, that will change multiple views in collapsing toolbar according to scrolling? For example I have three RelativeLayouts next to each other consisting of an ImageView (centered in parent) and text (below image) in collapsing toolbar. I want it for example to move image to left top, to move text to end of image and resize its height.

This wireframe shows a little what I would like to achieve:

Screenshot

Upvotes: 3

Views: 1180

Answers (1)

Vova
Vova

Reputation: 1091

Try use CollapsingToolbarLayout in the AppBarLayout.

Put big views to the CoollapingToolbarLayout. And Small views in the Toolbar.

You can try play with flag: app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"

If you want create rely cool animation for text in the text view. You must implement all behavior in Java code.

Upvotes: 3

Related Questions