OpenHarmony UI动画-recyclerview_animators

简介

带有添加删除动画效果以及整体动画效果的list组件库

下载安装

复制代码
ohpm install @ohos/recyclerview-animators

OpenHarmony ohpm 环境配置等更多内容,请参考如何安装OpenHarmony ohpm 包

使用说明

  1. 引入组件库

    import { RecyclerView } from "@ohos/recyclerview-animators"

  2. 在代码中使用

    @State controller: RecyclerView.Controller = new RecyclerView.Controller()
    private listDatas = ["A","B","C"]

    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()

约束与限制

在下述版本验证通过:

  • DevEco Studio 版本: 4.1 Canary(4.1.3.317)
  • OpenHarmony SDK: API11 (4.1.0.36)

目录结构

复制代码
|---- recyclerview_animators  
|     |---- entry  # 示例代码文件夹
|     |---- library  # 库文件夹
|	    |----src
          |----main
              |----ets
                  |----components
                      |----adapterAnimator #动画效果适配
                      |----itemAnimator #元素动画效果实现
                      |----RecyclerView.ets #核心类
|           |---- Index.ets  # 对外接口
|     |---- README.md  # 安装使用方法                    

为了能让大家更好的学习鸿蒙(HarmonyOS NEXT)开发技术,这边特意整理了《鸿蒙开发学习手册》(共计890页),希望对大家有所帮助:https://qr21.cn/FV7h05

《鸿蒙开发学习手册》:

如何快速入门:https://qr21.cn/FV7h05

  1. 基本概念
  2. 构建第一个ArkTS应用
  3. ......

开发基础知识:https://qr21.cn/FV7h05

  1. 应用基础知识
  2. 配置文件
  3. 应用数据管理
  4. 应用安全管理
  5. 应用隐私保护
  6. 三方应用调用管控机制
  7. 资源分类与访问
  8. 学习ArkTS语言
  9. ......

基于ArkTS 开发:https://qr21.cn/FV7h05

  1. Ability开发
  2. UI开发
  3. 公共事件与通知
  4. 窗口管理
  5. 媒体
  6. 安全
  7. 网络与链接
  8. 电话服务
  9. 数据管理
  10. 后台任务(Background Task)管理
  11. 设备管理
  12. 设备使用信息统计
  13. DFX
  14. 国际化开发
  15. 折叠屏系列
  16. ......

鸿蒙开发面试真题(含参考答案):https://qr18.cn/F781PH

鸿蒙开发面试大盘集篇(共计319页):https://qr18.cn/F781PH

1.项目开发必备面试题

2.性能优化方向

3.架构方向

4.鸿蒙开发系统底层方向

5.鸿蒙音视频开发方向

6.鸿蒙车载开发方向

7.鸿蒙南向开发方向

相关推荐
Csvn9 分钟前
diff 算法(虚拟 DOM Reconciliation)
前端
前端snow1 小时前
ai agent --- 文件存储
前端
Frag0ut1 小时前
Chrome四大版本获取及共存指南:Stable/Beta/Dev/Canary
前端·chrome·浏览器·dev·beta·canary·共存版
resh_people2 小时前
开源鸿蒙平台 KMP_CMP 三方库「Kermit」适配全流程
华为·开源·harmonyos
IT_陈寒3 小时前
SpringBoot自动配置坑了我一把,原来是这样绕过去的
前端·人工智能·后端
广州华水科技3 小时前
单北斗GNSS变形监测在大坝安全监测中的应用与优势
前端
zeng不错3 小时前
B站 173 个投稿活动看到眼瞎?我写了个扩展,主打一个精准打击
前端
Latchh3 小时前
前端导出的JPEG红字发糊,质量要拉到100才清楚
前端·图像处理·人工智能·计算机视觉
默_笙4 小时前
🚦 请三个 AI 考官给 RAG 打分:量化评估实战(下)
前端·javascript
Joy T4 小时前
聊天系统中五大ID的演进与实战解析
java·前端·人工智能·spring·agent入门