android - 与 CollapsingToolbarLayout 一起使用时,Recycler View 不会过度滚动
问题描述
我有以下带有可折叠工具栏布局和回收站视图的布局。不知何故,它不允许 recyclerview 过度滚动。我怎样才能做到这一点?谢谢!
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar_layout"
android:layout_width="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
style="@style/ToolbarStyle"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize">
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<View
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"/>
</LinearLayout>
解决方案
CoordinatorLayout 1.1.0(Material 1.1.0 的基础)和RecyclerView 1.1.0的很大一部分正在迁移到新的嵌套滚动 API,这些 API 专门用于解决过度滚动无法在视图之间正确传输的情况.
您应该升级到 Material 1.1.0 和 RecyclerView 1.1.0。
推荐阅读
- elixir - mix.exs 文件中的 Elixir 版本要求无效
- java - 具有任何深度的嵌套项目的 Recyclerview
- python - 使用 Python 执行动态 SQL 但收到异常
- python - Kivy - 如果满足条件,如何更改每个文本输入的颜色
- c# - ASP.NET Core MVC/WebAPI 身份验证方案加匿名
- gerrit - 如何使用新补丁集在 Gerrit 中保留批准
- c++ - 使用 boost 套接字禁用 TIME_WAIT
- python - 如何找到 DBSCAN 的最佳参数?
- python-3.x - 尝试使用 tkinter gui 停止 Python 语音识别循环
- javascript - 范围问题 - 在回调中更改数据正在更改更高范围