为什么Pull To Refresh不会在两次刷新后停止

时间:2014-09-25 11:34:24

标签: android android-listview

我设置了this库。在我的代码下面。当我第一次刷新时,所有工作都很好,但如果我第二次刷新更多,刷新就不会停止。如何解决?

PullToRefreshListView pullToRefreshView;
ArrayList<String> list = new ArrayList<String>();
ListAdapter adapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my);

    pullToRefreshView = (PullToRefreshListView)findViewById(R.id.pull_to_refresh_listview);
    pullToRefreshView.setMode(Mode.BOTH);

    adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list);
    pullToRefreshView.setAdapter(adapter);

    pullToRefreshView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
        @Override
        public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
            list.add("Item down =-=");
            refreshView.onRefreshComplete();
        }

        @Override
        public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
            list.add("Item up =-=");
            refreshView.onRefreshComplete();
        }
    });

}

0 个答案:

没有答案