# ARecyclerView
**Repository Path**: chinasoft_ohos/ARecyclerView
## Basic Information
- **Project Name**: ARecyclerView
- **Description**: list列表组件的封装
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 2
- **Forks**: 2
- **Created**: 2021-04-12
- **Last Updated**: 2024-11-08
## Categories & Tags
**Categories**: harmonyos-listview
**Tags**: None
## README
# ARecyclerview
#### 项目介绍
- 项目名称:ARecyclerview
- 所属系列:openharmony的第三方组件适配移植
- 功能:ARecyclerview是一个支持展示自定义content,error,empty,loading页面的控件,并支持下拉树新,上拉加载更多数据。
- 项目移植状态:主功能完成
- 调用差异:无
- 开发版本:sdk6,DevEco Studio2.2 Beta1
- 基线版本: Release V1.2.4
#### 效果演示
#### 安装教程
1.在项目根目录下的build.gradle文件中,
```gradle
allprojects {
repositories {
maven {
url 'https://s01.oss.sonatype.org/content/repositories/releases/'
}
}
}
```
2.在entry模块的build.gradle文件中,
```xml
dependencies {
implementation('com.gitee.chinasoft_ohos:ARecyclerview:1.0.0')
}
```
在sdk6,DevEco Studio2.2 Beta1下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下
#### 使用说明
xml引用方式:
RecyclerView引用
```xml
```
RecyclerContentLayout引用
```xml
```
Java调用:
```java
XRecyclerView listContainer = (XRecyclerView) findComponentById(ResourceTable.Id_list_container);
listContainer.setLoadingListener(new XRecyclerView.LoadingListener() {
@Override
public void onRefresh() {
//下拉刷新
}
@Override
public void onLoadMore() {
//上拉加载更多
});
```
RecyclerAdapter使用
```java
public class SettingProvider extends XRecyclerView.RecyclerAdapter {
}
```
切换不同状态的ContentLayout使用
```java
//添加添加自定义的组件到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.0.0