Swipe down to update your material design

I was looking for opportunities to implement a new material design to update the RecyclerViews with a loading circle descending from the ActionBar like a new Gmail app. I haven't found anything like this yet, just some examples of SwipeRefreshLayout + RecyclerView. Does anyone know how to do this?

+3


source to share


1 answer


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 conjunction 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 can help!

+20


source







All Articles