I have a RecyclerView that I wish to freeze (ie, not allow the user to scroll, but still be able to tap any current visible views) until a certain condition is met. How do I achieve this?
I've tried to set an OnScrollListener
as following:
@Override
public void onScrolled(final RecyclerView recyclerView, final int dx, final int dy) {
super.onScrolled(recyclerView, dx, dy);
if(myCondition){
recyclerView.stopScroll();
}
});
without success.
I've figured it out.
OnItemTouchListener
should be used instead:Now you add it to your RecyclerView:
If anyone finds an easier way, please, let me know!