1.MaterialRefreshLayout刷新加载:
导入依赖:
compile 'com.cjj.materialrefeshlayout:library:1.3.0'
布局
//设置进度颜色
int[] colors = new int[1]; colors[0] = getResources().getColor(R.color.back347); refresh.setProgressColors(colors); //允许上拉加载
refresh.setLoadMore(true); //关闭刷新加载按钮
refresh.finishRefreshLoadMore(); refresh.finishRefreshing();
//刷新加载监听
refresh.setMaterialRefreshListener(new MaterialRefreshListener() { @Override public void onRefresh(MaterialRefreshLayout materialRefreshLayout) { /** * 刷新 */ page = 1; isRequst = true; requstMessage(); LogUtils.e("刷新"); } @Override public void onRefreshLoadMore(MaterialRefreshLayout materialRefreshLayout) { // TODO Auto-generated method stub super.onRefreshLoadMore(materialRefreshLayout); if (isRequst) { page++; LogUtils.e("加载"); requstMessage(); } } });