SwipeRefreshLayout With NestedScrollView — Android
Refresh you View Content with SwipeRefreshLayout
In Android we have SwipeRefreshLayout, we often used this in our layouts to refresh the content of a view with the vertical gesture feature, whenever we need it. The
SwipeRefreshLayout can only support direct one child only, so whenever we need to add in our layout, we always try to add before our RecyclerView like this below code snippet:
Visit my website at https://danishamjad.com/
Recently I have been working in an Application where I have a
NestedScrollView, and I need to add a
SwipeRefreshLayout, so I just Implemented the way it looked above simply put the
SwipRefreshLayout above the
After that, I just run the application and guess what, nothing happened and the data was not showing in the list, so then I figured it out what’s goes wrong in the Implementation.
How to Solve:
The solution is very simple, We need to add a SwipRefreshLayout above the NestedScrollView and So you should move
That’s it just runs your application and sees the results.
Let’s see with the XML File.
This article described you how to Implement the SwipeRefreshLayoyut with NestedScrollView, hows the Implementation is different from the traditional one.
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: