Published in


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

Recently I have been working in an Application where I have a RecyclerView with CoolapingToolbar and NestedScrollView, and I need to add a SwipeRefreshLayout, so I just Implemented the way it looked above simply put the SwipRefreshLayout above the RecyclerView.

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 app:layout_behavior="@string/appbar_scrolling_view_behavior" from NestedScrollView to SwipeRefreshLayout.

That’s it just runs your application and sees the results.

Let’s see with the XML File.

SwipRefreshLayout With NestedScrollView


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:

Enjoy and Happy Coding!

Sharing (knowledge) is caring 😊 Thanks for reading this article. Be sure to clap or recommend this article if you found it helpful. It means a lot to me.

If you need any help then Join me on Twitter, LinkedIn, GitHub, and Subscribe to my Youtube Channel.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Danish Amjad

Danish Amjad


Senior Mobile Engineer (Android). Open Source Contributor, Technical Writer, Email: check my website at