标签:xlistview
需要导入library
//找控件
xlv = (XListView) findViewById(R.id.xlv);
xlv.setPullRefreshEnable(true);
xlv.setPullLoadEnable(true);
//设置刷新监听
xlv.setXListViewListener(new XListView.IXListViewListener() {
@Override
public void onRefresh() {
Toast.makeText(MainActivity.this, "下拉刷新", Toast.LENGTH_SHORT).show();
handler.postDelayed(new Runnable() {
@Override
public void run() {
//停止
xlv.stopRefresh();
}
}, 2000);
}
@Override
public void onLoadMore() {
Toast.makeText(MainActivity.this, "上拉加载", Toast.LENGTH_SHORT).show(); handler.postDelayed(new Runnable() {
@Override
public void run() {
//停止
xlv.stopLoadMore();
}
}, 2000);
}
});
标签:xlistview
原文地址:http://13217579.blog.51cto.com/13207579/1956447