mXRecyclerView.setPullRefreshEnabled(true);
mXRecyclerView.setLoadingMoreEnabled(true);
mXRecyclerView.setLoadingListener(new XRecyclerView.LoadingListener() {
@Override
public void onRefresh() {
page=1;
initData();
mXRecyclerView.refreshComplete();
}
@Override
public void onLoadMore() {
page++;
initData();
mXRecyclerView.loadMoreComplete();
}
});
initData();
依赖
implementation 'com.jcodecraeer:xrecyclerview:1.5.9'
build.gradle android{}中配置以下
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '27.1.1'//根据你的底下appcompat-v7版本
}
}
}
}