OpenHarmony实战开发-手势事件

news/2024/10/19 1:28:30/

手势表示由单个或多个事件识别的语义动作(例如:点击、拖动和长按)。一个完整的手势也可能由多个事件组成,对应手势的生命周期。支持的事件有:

触摸

  • touchstart:手指触摸动作开始。
  • touchmove:手指触摸后移动。
  • touchcancel:手指触摸动作被打断,如来电提醒、弹窗。
  • touchend:手指触摸动作结束。

点击

click:用户快速轻敲屏幕。

长按

longpress:用户在相同位置长时间保持与屏幕接触。

具体的使用示例如下:

<!-- xxx.hml -->
<div class="container"><div class="text-container" onclick="click"><text class="text-style">{{onClick}}</text></div><div class="text-container" ontouchstart="touchStart"><text class="text-style">{{touchstart}}</text></div><div class="text-container" ontouchmove="touchMove"><text class="text-style">{{touchmove}}</text></div><div class="text-container" ontouchend="touchEnd"><text class="text-style">{{touchend}}</text></div><div class="text-container" ontouchcancel="touchCancel"><text class="text-style">{{touchcancel}}</text></div><div class="text-container" onlongpress="longPress"><text class="text-style">{{onLongPress}}</text></div>
</div>
/* xxx.css */
.container {width: 100%;height: 100%;flex-direction: column;justify-content: center;align-items: center;
}
.text-container {margin-top: 30px;flex-direction: column;width: 600px;height: 70px;background-color: #0000FF;
}
.text-style {width: 100%;line-height: 50px;text-align: center;font-size: 24px;color: #ffffff;
}
// xxx.js
export default {data: {touchstart: 'touchstart',touchmove: 'touchmove',touchend: 'touchend',touchcancel: 'touchcancel',onClick: 'onclick',onLongPress: 'onlongpress',},touchCancel: function (event) {this.touchcancel = 'canceled';},touchEnd: function(event) {this.touchend = 'ended';},touchMove: function(event) {this.touchmove = 'moved';}, touchStart: function(event) {this.touchstart = 'touched';},longPress: function() {this.onLongPress = 'longpressed';},click: function() {this.onClick = 'clicked';},
}

在这里插入图片描述

如果大家还没有掌握鸿蒙,现在想要在最短的时间里吃透它,我这边特意整理了《鸿蒙语法ArkTS、TypeScript、ArkUI等…视频教程》以及《鸿蒙开发>鸿蒙开发学习手册》(共计890页),希望对大家有所帮助:https://docs.qq.com/doc/DZVVBYlhuRkZQZlB3

鸿蒙语法ArkTS、TypeScript、ArkUI等…视频教程:https://docs.qq.com/doc/DZVVBYlhuRkZQZlB3

在这里插入图片描述

OpenHarmony APP开发教程步骤:https://docs.qq.com/doc/DZVVBYlhuRkZQZlB3

在这里插入图片描述

鸿蒙开发>鸿蒙开发学习手册》:

如何快速入门:https://docs.qq.com/doc/DZVVBYlhuRkZQZlB3

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

在这里插入图片描述

开发基础知识:https://docs.qq.com/doc/DZVVBYlhuRkZQZlB3

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

在这里插入图片描述

基于ArkTS 开发:https://docs.qq.com/doc/DZVVBYlhuRkZQZlB3

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

在这里插入图片描述

鸿蒙生态应用开发白皮书V2.0PDF:https://docs.qq.com/doc/DZVVkRGRUd3pHSnFG

在这里插入图片描述


http://www.ppmy.cn/news/1448976.html

相关文章

笨蛋学C++之 C++对数据库实现CRUD

笨蛋学C 之 C对数据库实现CRUD 头文件testcrud.h 源文件testcrud.cppmain.cpp 头文件 testcrud.h #pragma once #include <mysql.h> #include <iostream> #include <vector> #include <cstring> // 包含字符串操作相关的头文件 using namespace std;…

上市企业数字赋能指数数据集-2001到2022年(TF-IDF)

01、数据简介 上市公司数字赋能指数是一个用来衡量上市公司利用数字技术提高业务能力和效率的指标。这个指数反映了上市公司利用大数据、云计算和人工智能等数字技术&#xff0c;高效地利用商业资源和信息&#xff0c;并扩展供应关系的能力。市公司数字赋能指数是一种综合性的…

Boost读写xml

Boost读写xml 文章目录 Boost读写xml写在前面准备工作简单读写写xml读xml键值查找遍历 设置默认值异常处理 具有属性的xml写xml读xml键值查找遍历 知识补充 写在前面 ​ 前面我们讲过了如何使用Boost读写ini文件&#xff0c;这一篇我们将介绍如何用Boost读写xml文件。 ​ XML…

互联网医院系统源码开发实战教学:搭建在线问诊APP

今天&#xff0c;笔者将带领大家进行一次互联网医院系统源码开发的实战教学&#xff0c;让我们一起来探索搭建一个高效便捷的在线问诊平台。 一、需求分析和功能设计 在开始源码开发之前&#xff0c;我们首先需要进行需求分析和功能设计。一般来说&#xff0c;一个完善的在线…

【Flutter】极光推送配置流程(小米厂商通道) 章二

前言 继【Flutter】极光推送配置流程(极光通道/华为厂商/IOS) 章一 并且&#xff0c;我大概率不会去修改第一篇文章的内容。 随着我自己在配置公司的项目的同时&#xff0c;我希望一直更新这个推送系列文章。 在章一配置完后&#xff0c;也是出现了一些问题&#xff0c;所以本…

Acwing 818. 数组排序

给定一个长度为 n n n的数组 a a a以及两个整数 l l l和 r r r&#xff0c;请你编写一个函数&#xff0c;void sort(int a[], int l, int r)&#xff0c;将 a [ l ] ∼ a [ r ] a[l]∼a[r] a[l]∼a[r]从小到大排序。 输出排好序的数组 a。 输入格式 第一行包含三个整数 n &…

全网最强JavaWeb笔记 | 万字长文爆肝JavaWeb开发——day09Mybatis

万字长文爆肝黑马程序员2023最新版JavaWeb教程。这套教程打破常规&#xff0c;不再局限于过时的老套JavaWeb技术&#xff0c;而是与时俱进&#xff0c;运用的都是企业中流行的前沿技术。笔者认真跟着这个教程&#xff0c;再一次认真学习一遍JavaWeb教程&#xff0c;温故而知新&…

XML:简介

一、何为XML XML 指可扩展标记语言&#xff08;EXtensible Markup Language&#xff09;&#xff0c;设计宗旨是传输数据&#xff0c;而非显示数据&#xff0c;其是W3C&#xff08;指万维网联盟&#xff08;World Wide Web Consortium&#xff09;&#xff09;的推荐标准。 实例…