简体   繁体   中英

Android Swipe Up to Refresh ListView

I have to implement android swipe up to refresh listview. I got sample code from here . But in this code it is swipe down to refresh listview. And I want it in swipe up to refresh listview. If anyone know answer then please explain or suggest me link from where I can understand from beginning. Thank You.

Please Use

Link Library for scrolling bottom/Up by setting direction.

You can use other SO links too

SwipeRefreshLayout - Pull From Bottom

Previously we used to implement a custom swipe view to detect the swipe down. But android made our day easier by introducing SwipeRefreshLayout in android.support.v4 to detect the vertical swipe on any view.

Below link shows show step by step procedure

http://www.androidhive.info/2015/05/android-swipe-down-to-refresh-listview-tutorial/

You can use SwipeRefreshLayout,The layout you need to refresh should give inside this layout.

<android.support.v4.widget.SwipeRefreshLayout
  android:id="@+id/sw_refresh"
  android:layout_width="match_parent" 
  android:layout_height="wrap_content">

  <!--layout which should be refreshed should come here-->

      <ListView
        android:layout_width="match_parent"
        android:layout_height="match_parent"></ListView>

       </android.support.v4.widget.SwipeRefreshLayout>

   </RelativeLayout>

You can see the complete implementation at Android swipe to refresh listview layout

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM