简体   繁体   中英

Children of CollapsingToolbarLayout with different collapse modes

I would like to create a CollapsingToolbarLayout that contains two views (one below the other - like a LinearLayout manner). The problem is that i would like these views to have different collapse modes - upper one parallax, the other - none.

When I put them in one LinearLayout I can only set the collapse mode to this LinearLayout, so both views behave the same.

I tried putting one view inside a Toolbar and that wat I can achieve two different collapse modes, but I cant get them to be one under the other - I can't simply set a margin because the upper view has a dynamic height so I would need some kind of anchoring.

Consider using MotionLayout . All you have to do is define the start and end states (In this case, the start state will have both of them visible, and the end state will have the top one gone with parallax effect).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM