Search code examples
androidandroid-recyclerviewrefreshandroid-support-libraryswipe

Recyclerview swipe up to refresh in android on API 21


I want "swipe up to refresh content" feature in recycler view (similar to SwipeRefreshLayout).

Currently I have a button which refreshes the view when tapped and I'd like to do the same using swiping up. The only problem is that SwipeRefreshLayout is available since API 22.

Is it possible to be done when using API 21?


Solution

  • Use android.support.v4.widget.SwipeRefreshLayout. Add in your build.gradle compile 'com.android.support:support-v4:x.x.x' where x.x.x is the last version of support library.