下拉加载延迟方法

xListView.setXListViewListener(new IXListViewListener() {

            // 下拉刷新的回调方法
            public void onRefresh() {

                data.clear();

                // TODO Auto-generated method stub

                zixiancheng();
                new Handler().postDelayed(new Runnable() {
                    public void run() {
                        count = 20;
                        xListView.stopRefresh();
                    }
                }, 1000);

                // // 下拉刷新,应该展示最新数据,所以清空集合
                // arrayAdapter.notifyDataSetChanged();
                //
                // // 设置刷新时间
                // xListView.setRefreshTime(dateFormat());
                // // 停止加载更多
                // xListView.stopLoadMore();
                // // 停止刷新
                // xListView.stopRefresh();

            }

            // //上拉加载的回调方法
            public void onLoadMore() {

                zixiancheng();
                new Handler().postDelayed(new Runnable() {

                    public void run() {
                        count += 20;
                        xListView.stopLoadMore();
                    }
                }, 1000);

                // arrayAdapter.notifyDataSetChanged();
                //
                // // 停止加载更多
                // xListView.stopLoadMore();
                // // 停止刷新
                // xListView.stopRefresh();
            }
        });

posted @ 2016-08-23 15:24  tianliheng  阅读(324)  评论(0)    收藏  举报