Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 927
Abhilash Avatar asked Mar 10 '15 13:03

Abhilash


People also ask

How do I stop recycler view from scrolling?

As setLayoutFrozen is deprecated, You can disable scrolling by freezing your RecyclerView by using suppressLayout . Show activity on this post. You can disable scrolling by freezing your RecyclerView.

How do I stop NestedScrollView scrolling?

setnestedscrollingenabled set it to false.

How do I prevent NestedScrollView from scrolling if body is small?

The problem can be solved by moving the SliverAppBar into the CustomScrollView and not use the NestedScrollView at all.

How do I stop refreshing RecyclerView data scroll to top position Android?

Just set your LayoutManager and adapter for the first time. Make a setDataList method in your adapter class. And set your updated list to adapter list. And then every time of calling API set that list to setDataList and call adapter.

How to enable/disable scrolling functionality of my recycle-view?

Here using "isScrollEnabled" flag you can enable/disable scrolling functionality of your recycle-view temporarily. Simple override your existing implementation to disable scrolling and allow clicking. linearLayoutManager = new LinearLayoutManager (context) { @Override public boolean canScrollVertically () { return false; } };

How to disable scroll/swipe events in recyclerview?

Instead of returning true, and therefore disabling all sorts of touch events, just return e.getAction () == MotionEvent.ACTION_MOVE; instead of return true; so only scroll/swipe events get cancelled. As setLayoutFrozen is deprecated, You can disable scrolling by freezing your RecyclerView by using suppressLayout.

Why does my view disappear when I scroll down or back?

After that when I scroll down or go up the view back to its normal position like the changes that I made it’s gone from view. It is because RecyclerView recycles every view which is not visible to the user. So, when the user scrolls back it recycles the previous view which is in normal form.

How to change the background color of itemview when user scrolls bottom?

So, when it is called we stored a flag value in our BokkModel class. Now when the user scrolls bottom or comes back to the previous position the view never changes. You can also add ClickListener on itemView when the user taps on the row you can change the background color and store in the model.


2 Answers

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.

like image 115
mipreamble Avatar answered Oct 22 '22 04:10

mipreamble


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.
like image 37
waqaslam Avatar answered Oct 22 '22 05:10

waqaslam