首页 > 解决方案 > RecyclerView 滚动在 NestedScrollView 内不起作用

问题描述

我检查了很多答案,但没有一个解决方案适合我!

我的布局是:

<NestedScrollView>
  <LinearLayout>
     <OtherLayouts>
     <LinearLayout>
       <RecyclerView>
       <OtherLayouts>
     </LinearLayout>
  </LinearLayout>
</NestedScrollView>

我的问题是我最初必须将 recyclerView 滚动到特定位置。我试过:recyclerView.setNestedScrollingEnabled(false)

我的 recyclerView 的高度已经设置为 wrap_content

很高兴提供任何其他细节。如果您知道解决方案,请提供帮助!

标签: androidandroid-recyclerviewandroid-nestedscrollview

解决方案


你在 RecyclerView 中使用这条线吗

app:layout_behavior="@string/appbar_scrolling_view_behavior"

将管理其余的事情。


推荐阅读