LEE
LEE

Reputation: 3605

how to disable recycler view scrolling so that it listens to Scrollview layout?

I have a recycler view inside a ScrollView. I want to disable the recycler view scroll so that it listens to its parent layout, A ScrollView!

Upvotes: 15

Views: 32816

Answers (3)

F_Z
F_Z

Reputation: 591

Add this line in xml,

android:nestedScrollingEnabled="false"

Upvotes: 1

mipreamble
mipreamble

Reputation: 1415

This should solve your RecyclerView nested scrolling.

 mRecyclerView.setNestedScrollingEnabled(false);

RecyvlerView implements NestedScrollingChild

for instance if RecyclerView parent is a ScrollView or ListView or RecyclerView or any AbsListView

disable scrolling for the child RecyclerView.

Upvotes: 46

waqaslam
waqaslam

Reputation: 68187

Logically, it is not a good idea to put ListView inside a ScrollView. However, if you insist then:

  • You may either increase the ListView height based on the sum of its rows height as mentioned here.
  • Or let the recycling in place but intercept the touch on ListView to redirect scrolling to its parent ScrollView as mentioned here.

Upvotes: 6

Related Questions