CollapsingToolbarLayout的子项具有不同的折叠模式

huangapple go评论65阅读模式
英文:

Children of CollapsingToolbarLayout with different collapse modes

问题

我想创建一个包含两个视图的CollapsingToolbarLayout(一个在另一个下面 - 像LinearLayout一样)。问题是,我希望这些视图具有不同的折叠模式 - 上面的视图是视差,另一个是不折叠。

当我将它们放入一个LinearLayout中时,我只能将折叠模式设置为这个LinearLayout,所以两个视图的行为相同。

我尝试将一个视图放入一个工具栏中,这样我可以实现两种不同的折叠模式,但我不能让它们一个在另一个下面 - 我不能简单地设置一个边距,因为上面的视图具有动态高度,所以我需要某种方式进行定位。

英文:

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.

答案1

得分: 1

考虑使用MotionLayout。您只需定义起始和结束状态(在本例中,起始状态将使两者都可见,而结束状态将使顶部一个消失,带有视差效果)。

英文:

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).

huangapple
  • 本文由 发表于 2020年8月12日 18:27:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/63374607.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定