Android-Swipe to refresh layout

 

I always wondered how the pull to refresh feature worked but never actually got around to experimenting with it. Finally getting around to it, I was honestly a little underwhelmed seeing how easy it was to implement the feature.  Android Support Library to the rescue.

Most of the heavy lifting is taken care of  by SwipeRefreshLayout in the support library. It can be declared in the layout file using the following declaration : 

<android.support.v4.widget.SwipeRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/swiperefresh"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
.
.
.
</android.support.v4.widget.SwipeRefreshLayout>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s