SRKS
SRKS

Reputation: 218

RecyclerView need to scroll along the activity

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.

Upvotes: 0

Views: 1092

Answers (1)

Haresh Chaudhary
Haresh Chaudhary

Reputation: 4400

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>

Upvotes: 2

Related Questions