bvv
bvv

Reputation: 1903

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?

Upvotes: 5

Views: 4559

Answers (1)

Ruban
Ruban

Reputation: 1534

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
});

Upvotes: 2

Related Questions