具有固定/固定的工具栏和"enterAlways"功能的CollapsingToolbarLayout. [英] CollapsingToolbarLayout with fixed/pinned Toolbar and functionality of "enterAlways"

查看:55
本文介绍了具有固定/固定的工具栏和"enterAlways"功能的CollapsingToolbarLayout.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于材料设计指南的标准"CollapsingToolbarLayout"实现.

使用下面的设置,我可以实现图片上描绘的行为:

With the the settings below I was able to achieve behavior depicted on the picture:

<CoordinatorLayout ...>
    <AppBarLayout ...>
        <CollapsingToolbarLayout
            app:layout_scrollFlags="scroll|enterAlways"
            ...>
            <Toolbar
                app:layout_collapseMode="pin">
            </Toolbar>
            <MyCustomContent01 ... />
        </CollapsingToolbarLayout>
    </AppBarLayout>
    <MyCustomContent02 ... />
</CoordinatorLayout>

如何实现以下行为?

  • 向上滚动:即使我们不在列表顶部,也始终完全展开工具栏.
  • 向下滚动:只需折叠工具栏,但不要隐藏它.
  • Scrolling up: always expand the Toolbar fully, even if we are not on the top of the list.
  • Scrolling down: just collapse the Toolbar, but don't hide it.

换句话说:如何在保留步骤4的条件的同时摆脱步骤3?

In other words: How can I get rid of the step 3 while preserving the condition of step 4?

对我而言,关于该主题的最佳文章似乎就是这一篇,但是所提供的配置都不符合我的需求.

For me the best article on this topic seems to be this one, however none of the presented configurations match my needs.

尝试一个:

<CollapsingToolbarLayout
    app:layout_scrollFlags="scroll|enterAlways"
 ...>

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆