Horizontal RecyclerView Scrolling issue Inside SwipeRefreshLayout
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.
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 would like to give feedback, go ahead and leave a comment below. I’d appreciate the feedback.
I’ve written some other Android-related content, and if you liked what you read here, you’ll probably also enjoy this:
Define Resource Layout Id In the Constructor Activity/ Fragment — With AndroidX
Reduce the number of methods from your activity/fragment
Building UIs Using Android Jetpack Compose
No need to write XML layouts-Jetpack Compose will do the magic
Create an Instant App Using Android App Bundle
Using App Bundle in place of the deprecated Instant App feature plugin
Add version.properties file to your Android Project
Change from one file and reflect the changes on all the product flavors