![](/img/trans.png)
[英]Overscroll effect from bottom not appearing when using RecyclerView inside SwipeRefreshLayout
[英]Overscroll effect is not displayed correctly in NestedScrollView with RecyclerView inside
我有包含一些视图和 RecyclerView 的 NestedScrollView。 但是当我滚动 RecyclerView 时,过度滚动的效果只显示在里面。 如何在 NestedScrollView 中显示它?
我可以使用android:overScrollMode="never"
在 RecyclerView 中禁用过度滚动效果,但我不知道如何在滚动 RecyclerView 时在 NestedScrollView 中启用过度滚动效果。 我已经尝试了所有明显的解决方案。
<androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- My views here -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
PS:我需要将我的一些视图放在 RecyclerView 之外,否则 RecyclerView 适配器会变得不必要地复杂(有必要描述所有类型的元素)。 请不要说这对性能不利。 就我而言,这无关紧要。
请通过NestedScrollView 参考文档 go了解更多信息。
并添加recyclerView.setNestedScrollingEnabled(false);
到您的RecyclerView
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.