Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How set pull up for refresh SwipeRefreshLayout

I see very much libraries for ListView pull to refresh. But they are work, when pull from top to down, but how i can do refresh when pull from bottom to up? Can i make this with SwipeRefreshLayout ? If no, what library i must use? And how do that?

like image 383
bvv Avatar asked Oct 31 '22 16:10

bvv


1 Answers

use chrisbanes 's library: https://github.com/chrisbanes/Android-PullToRefresh which supports listview, gridview, scrollview, webview ...

To refresh listview from bottom, just set mode for it. Here is an example :

PullToRefreshListView ptr= 
  (PullToRefreshListView) findViewById(R.id.listview);
mPullRefreshListView.setMode(Mode.BOTH);    // mode refresh for top and bottom
mPullRefreshListView.setShowIndicator(false); //disable indicator
mPullRefreshListView.setPullLabel("Loading");

 ptr.setOnRefreshListener(new OnRefreshListener<ListView>() {
            public void onRefresh(PullToRefreshBase<ListView> refreshView) {
          //do something when refresh
});
like image 162
Ruban Avatar answered Nov 15 '22 04:11

Ruban