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  # 安装使用方法                    
```### 写在最后

**如果你觉得这篇内容对你还蛮有帮助,我想邀请你帮我三个小忙**:
*   点赞,转发,有你们的 『点赞和评论』,才是我创造的动力。
*   关注小编,同时可以期待后续文章ing🚀,不定期分享原创知识。
*   **想要获取更多完整鸿蒙最新学习资源,请移步前往小编:[`gitee.com/MNxiaona/733GH`](https://gitee.com/MNxiaona/733GH)**

![](https://i-blog.csdnimg.cn/direct/e9e45b82da9441889c6c17e0791831bc.jpeg#pic_center)
相关推荐
大蓝头2 天前
安装包UI美化之路-nsNiuniuSkin全新UI调试与预览方法
ui·electron·安装包·截图控件·截屏控件
慧都小项2 天前
当边缘AI上产线:QtitanDocking 如何让工业 HMI 实现多视图协同
人工智能·qt·ui·边缘计算·qt6.3
兰亭妙微UI设计公司3 天前
兰亭妙微UI设计公司分享:EQUA 智能健康生态系统 UI/UX 设计深度解析
ui·交互
Cx330❀3 天前
Qt 常用控件属性与底层机制详解:从窗口半透明、浮点数陷阱到 QSS 与焦点策略
qt·ui·图形渲染
贾伟康3 天前
【HarmonyOS 7新能力|046】智慧手势工程封装:把接入逻辑放进可维护的分层结构
人机交互·harmonyos·arkts·arkui·手势识别
贾伟康3 天前
【HarmonyOS 7新能力|045】LazyLayoutAlgorithm工程封装:把接入逻辑放进可维护的分层结构
性能优化·harmonyos·arkts·arkui·懒加载
Cx330❀3 天前
Qt 常用 UI 控件详解:从QPushButton到QLabel 核心用法解析
qt·ui·图形渲染
传奇开心果编程4 天前
【ArkUI 练中学】第15课:UI 界面设计与实战
学习·ui·华为·harmonyos
HwJack204 天前
【HarmonyOS开发小实践】ArkUI 动画系统属性动画、显式动画与路径动画
ui·性能优化·harmonyos
传奇开心果编程4 天前
【Flutter入门练中学】第2课:布局系统
学习·flutter·ui