ListView下拉刷新

1.ListView外层添加控件:

android.support.v4.widget.SwipeRefreshLayout

2.代码实现:

mSwipe.setProgressBackgroundColorSchemeResource(android.R.color.white);

// 设置下拉进度的主题颜色

mSwipe.setColorSchemeResources(R.color.colorAccent, R.color.colorPrimary, R.color.colorPrimaryDark);

//设置监听

mSwipe.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

@Override

public void onRefresh() {

mList.clear();

mPageIndex = 1;

getInfo();

}

});

//关闭加载动画

mSwipe.setRefreshing(false);




阅读更多

没有更多推荐了,返回首页