Horizontal RecyclerView Scrolling issue Inside SwipeRefreshLayout

Resolve the issue during Scrolling

Danish Amjad
AndroidPub

--

Image credits:

This story belongs to what I have learned today, Currently working in an Application In which we have the parent SwipeRefreshLayout in which we have the vertical recyclerView and inside vertical recyclerView we have the horizontal recyclerView.

The Problem which we were facing that whenever we scrolled horizontally sometimes the list not scrolled properly and we identified the lagging issue during scrolling the horizontal list.

Solution:

The solution for this is to make your own class and extend with SwipeRefreshLayout and check the touch gesture in onInterceptTouchEvent(). If the difference > myTouch then return false. You can see from the below code snippet how I achieved this.

Now define your customSwipeRefresh layout in your XML and you will see the scrolling will be smooth without any issue.

I hope this article is helpful. If you think something is missing, have questions, or…

--

--

Danish Amjad
AndroidPub

Senior Mobile Engineer (Android). Open Source Contributor, Technical Writer, ✉️ Dani.amjad12@gmail.com 🔗 https://danishamjad12.github.io