简体   繁体   English

如何为3个recyclerView创建一个滚动条android

[英]how to create one scrollbar for 3 recyclerView android

I need to create 1 scrollbar to scroll 3x recyclerView at the same time, i know that it is possible to scroll RView with layoutMatager.scrollTo etc but i dont understand how to make scrollbar我需要创建 1 个滚动条来同时滚动 3x recyclerView,我知道可以使用 layoutMatager.scrollTo 等滚动 RView,但我不明白如何制作滚动条

Two things, you need to do.有两件事,你需要做。

  1. Wrap up recyclerviews inside nested scrollview.将 recyclerviews 包裹在嵌套的滚动视图中。

     <androidx.core.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="vertical" android:fillViewport="true"> //<RecyclerView 1> //<RecyclerView 2> //<RecyclerView 3> </androidx.core.widget.NestedScrollView>
  2. And then call setNestedScrollingEnabled function to the recyclerview like this while setting adapter.然后在设置适配器时像这样调用setNestedScrollingEnabled function 到回收站视图。

 recycler1.isNestedScrollingEnabled = false recycler2.isNestedScrollingEnabled = false recycler3.isNestedScrollingEnabled = false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM