Fetch the repository succeeded.
1.在项目根目录下的build.gradle文件中,
allprojects {
repositories {
maven {
url 'https://s01.oss.sonatype.org/content/repositories/releases/'
}
}
}
2.在entry模块的build.gradle文件中,
dependencies {
implementation('com.gitee.chinasoft_ohos:ARecyclerview:1.0.0')
}
在sdk6,DevEco Studio2.2 Beta1下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下
xml引用方式: RecyclerView引用
<cn.droidlover.xrecyclerview.XRecyclerView
ohos:id="$+id:list_container"
ohos:height="match_parent"
ohos:width="match_parent"
ohos:layout_alignment="horizontal_center"
/>
RecyclerContentLayout引用
<cn.droidlover.xrecyclerview.XRecyclerContentLayout
ohos:id="$+id:x_recycle_view"
ohos:height="match_parent"
ohos:width="match_parent"/>
Java调用:
XRecyclerView listContainer = (XRecyclerView) findComponentById(ResourceTable.Id_list_container);
listContainer.setLoadingListener(new XRecyclerView.LoadingListener() {
@Override
public void onRefresh() {
//下拉刷新
}
@Override
public void onLoadMore() {
//上拉加载更多
});
RecyclerAdapter使用
public class SettingProvider<T> extends XRecyclerView.RecyclerAdapter<T> {
}
切换不同状态的ContentLayout使用
//添加添加自定义的组件到EmptyView
private void addEmptyComponent() {
EmptyComponent emptyComponent = new EmptyComponent(this);
XRecyclerContentLayout.addEmptyView(emptyComponent);
}
//添加自定义的组件到ErrorView
private void addErrorComponent() {
ErrorComponent errorComponent = new ErrorComponent(this);
XRecyclerContentLayout.addErrorView(errorComponent);
}
//添加添加自定义的组件到LoadingView
private void addLoadingComponent() {
loadComponent = new LoadingComponent(this);
XRecyclerContentLayout.addLoadingView(loadComponent);
loadComponent.startLoading();
}
//添加添加RecyclerView到Content
private void addContentComponent() {
listContainer = new XRecyclerView(this);
listContainer.setWidth(ComponentContainer.LayoutConfig.MATCH_PARENT);
listContainer.setHeight(ComponentContainer.LayoutConfig.MATCH_PARENT);
listContainer.setReboundEffect(true);
XRecyclerContentLayout.addContentView(listContainer);
SettingProvider provider = new SettingProvider(getData(1), this);
listContainer.setItemProvider(provider);
listContainer.setLoadingListener(new XRecyclerView.LoadingListener() {
@Override
public void onRefresh() {
}
@Override
public void onLoadMore() {
}
});
}
CodeCheck代码测试无异常
CloudTest代码测试无异常
病毒安全检测通过
当前版本demo功能与原组件基本无差异
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. Open source ecosystem
2. Collaboration, People, Software
3. Evaluation model