# recyclerview-animators-ets **Repository Path**: caolang304/recyclerview-animators-ets ## Basic Information - **Project Name**: recyclerview-animators-ets - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 17 - **Created**: 2022-04-25 - **Last Updated**: 2022-04-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # recyclerview_animators_ets ## 简介 > 带有添加删除动画效果以及整体动画效果的list组件库 ![](animation.gif) ## 下载安装 ```shell npm install @ohos/recyclerview_animators_ets --save ``` OpenHarmony npm环境配置等更多内容,请参考 [如何安装OpenHarmony npm包](https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_npm_usage.md) 。 ## 使用说明 1. 引入组件库 ``` import { RecyclerView } from "@ohos/recyclerview_animators_ets" ``` 2. 在代码中使用 ``` @State controller: RecyclerView.Controller = new RecyclerView.Controller() private listDatas = ["A","B","C"] private aboutToAppear() { this.controller.setAdapterAnimation(RecyclerView.AdapterAnimationType.AlphaIn) // 设置列表整体效果类型 this.controller.setFirstOnly(false) // 设置是否在item重复出现时显示动画效果 this.controller.setDuration(500) // 设置动画时长 } build() { Column() { RecyclerView({ array: this.listDatas, // 数据源 controller: this.controller, // 控制器 child: (itemData) => { this.SpecificChild(itemData) // 子布局 } }) } } @Builder SpecificChild(itemData) { Column() { Image($r("app.media.chip")) .width('100%') .height(100) Text(itemData + '') .fontSize(20) .textAlign(TextAlign.Center) .width('100%') }.margin(10) } ``` ## 接口说明 `controller: RecyclerView.Controller = new RecyclerView.Controller()` 1. 设置列表整体效果类型 `this.controller.setAdapterAnimation()` 2. 设置是否在item重复出现时显示动画效果 `this.controller.setFirstOnly()` 3. 设置动画时长 `this.controller.setDuration()` ## 兼容性 支持 OpenHarmony API version 8 及以上版本。 ## 目录结构 ```` |---- recyclerview_animators_ets | |---- entry # 示例代码文件夹 | |---- recyclerview_animators_ets # 库文件夹 | |----src |----main |----ets |----components |----adapterAnimator #动画效果适配 |----itemAnimator #元素动画效果实现 |----RecyclerView.ets #核心类 | |---- index.ets # 对外接口 | |---- README.md # 安装使用方法 ```` ## 贡献代码 使用过程中发现任何问题都可以提 [Issue](https://gitee.com/openharmony-sig/recyclerview-animators-ets/issues) 给我们,当然,我们也非常欢迎你给我们发 [PR](https://gitee.com/openharmony-sig/recyclerview-animators-ets/pulls) 。 ## 开源协议 本项目基于 [Apache License 2.0](https://gitee.com/openharmony-sig/recyclerview-animators-ets/blob/master/LICENSE) ,请自由地享受和参与开源。