I've been looking around for the implementation of the new material design swipe down to refresh on RecyclerViews with the loading circle coming down from the ActionBar, like the new Gmail app. I haven't found anything similar yet, only some SwipeRefreshLayout+RecyclerView examples. Does anyone know how to do this?
Asked
Active
Viewed 5,804 times
1 Answers
20
You can use the SwipeToRefresh view provided in the appcombat support library:
compile 'com.android.support:appcompat-v7:21.0.0'
Here's how you can use it in combination with RecyclerView
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:clipToPadding="false"
android:layout_height="match_parent"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin" />
</android.support.v4.widget.SwipeRefreshLayout>
Hope I could help!

teh.fonsi
- 3,040
- 2
- 27
- 22
-
Makes so much sense. Thanks, I will try this. – Hugo M. Zuleta Nov 07 '14 at 15:07
-
can we use in older version like 2.3?? – Sagar Maiyad Dec 10 '14 at 05:35