0

I have a situation like this

<Header> 
 <RecylerView>
<Header> 
 <RecylerView>

Everything works fine - here is one thing I want to achieve.

When I scroll on the page, I need to scroll it as one list. But now as there are two list I can scroll inside the recycler view.

  • 1
    Why don't you use one `RecyclerView` and make you adapter handle the views depending on whether it's a header or a data item? you can try [this](https://stackoverflow.com/a/26245463/886001) to handle different view types – ColdFire Oct 13 '17 at 14:22
  • Its complex inside as I have drag and drop inside each Recycle view. And drag and drop is recycle view dependent. – Sreeram Sunkara Oct 13 '17 at 14:58

1 Answers1

2

If you want to use 2 RecyclerViews, you should use NestedScrollView as parent view, also add android:nestedScrollingEnabled="false" to both the RecyclerViews and they will scroll along the page as a single list:

<android.support.v4.widget.NestedScrollView>
  <Header> 
  <RecylerView
   android:nestedScrollingEnabled="false"   <-- P.S this tag is very important or else each recyclerview will scroll within them selves. 
   />
  <Header> 
  <RecylerView
   android:nestedScrollingEnabled="false" />
</android.support.v4.widget.NestedScrollView>
Haresh Chaudhary
  • 4,390
  • 1
  • 34
  • 57