扫一扫,分享给好友
描述:用于触发滑动事件,滑动最小速度为100vp/s时识别成功。
Api:从API Version 8开始支持
接口:SwipeGesture(value?: { fingers?: number; direction?: SwipeDirection; speed?: number })
参数:
SwipeDirection枚举:
事件:
示例代码:
@Entry @Component struct SwipeGestureExample { @State rotateAngle: number = 0; @State speed: number = 1; build() { Column() { Column() { Text("SwipeGesture speed\n" + this.speed).fontSize(20) Text("SwipeGesture angle\n" + this.rotateAngle).fontSize(20) } .border({ width: 3 }) .width(300) .height(200) .margin(100) .rotate({ angle: this.rotateAngle }) // 单指竖直方向滑动时触发该事件 .gesture( SwipeGesture({ direction: SwipeDirection.Vertical }) .onAction((event: GestureEvent) => { this.speed = event.speed; this.rotateAngle = event.angle; }) ) }.width('100%') } } 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.
复制
示例效果: 代码地址: [https://gitee.com/jltfcloudcn/jump_to/tree/master/TapGesture]*附件:SwipeGesture.docx
发布
HarmonyOS 华为 鸿蒙系统 HarmonyOS 操作系统 RTOS OpenHarmony 同欣智能科技 移植 系统架构 全场景 分布式 鸿蒙操作系统 微内核 鸿蒙3.0 原子化服务
HarmonyOS/OpenHarmony应用开发-路径动画
#深入浅出学习eTs#(十三)滑动块提示
《HarmonyOS原子化服务卡片原理与实战》清华大学出版社李洋著
Harmony/OpenHarmony应用开发-转场动画组件内转场
HarmonyOS原子化服务最新概念、呈现形式与触发方式
基于鸿联标准系统开发板的毛泽东诗文应用
Harmony/OpenHarmony应用开发-转场动画页面间转场
不止于大,如何打造优秀的折叠屏应用体验
ArkUI,更高效的框架设计
Harmony/OpenHarmony应用开发-矩阵变换
电子发烧友网
电子发烧友论坛