仅在折叠工具栏中的工具栏上捕捉滚动标志

问题描述

我有一个带有固定工具栏的折叠工具栏,我希望折叠工具栏的可用空间可以自由滚动,但固定工具栏可以快速打开或关闭,我的问题是这可以通过滚动标志来实现还是我需要创建自定义布局行为或根据工具栏偏移量禁用和启用标志,以便说明我想要的图片,

我想允许这个例子完全展开

fully expanded

这将是一个自由滚动的自由空间(无捕捉)的例子

half scroll

这将是完全滚动的折叠工具栏和固定工具栏

collapsed

但我永远不想允许这种情况

toolbar not snapping

这是固定工具栏也可以自由滚动(作为折叠工具栏的子项)我只希望这个工具栏有一个对齐的滚动标志,但实际上这不起作用,工具栏标志被忽略

    <com.google.android.material.appbar.CollapsingToolbarLayout
        android:id="@+id/toolbar_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:descendantFocusability="blocksDescendants"
        app:titleEnabled="false"
        app:title=""
        app:titleTextColor="@android:color/transparent"
        app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@drawable/squareangle"
            app:titleTextColor="@android:color/transparent"
            app:title=""
            android:elevation="@dimen/large_margin_32dp"
            android:layout_gravity="top"
            android:minHeight="?attr/actionBarSize"
            app:elevation="@dimen/large_margin_32dp"
            app:layout_scrollFlags="snap"
            app:layout_collapseMode="pin"/>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)