• Home
Name Date Size #Lines LOC

..--

entry/12-May-2024-888807

hvigor/12-May-2024-2422

screenshots/devices/12-May-2024-

.gitignoreD12-May-2024171 1313

README_en.mdD12-May-2024550 1810

README_zh.mdD12-May-20241.7 KiB6643

build-profile.json5D12-May-20241 KiB4241

hvigorfile.tsD12-May-2024165 21

hvigorwD12-May-20242 KiB6228

hvigorw.batD12-May-20242 KiB7356

oh-package.json5D12-May-2024836 2826

ohosTest.mdD12-May-2024873 149

README_en.md

1# Drag Event
2
3### Introduction
4
5This sample shows the drag operation function.
6
7### Usage
8
91. Drag an icon on the home screen to swap its position with any other icon on the home screen.
102. Drag an icon on the home screen to any position on the dock bar at the bottom.
113. Drag an icon on the dock bar to swap its position with any other icon in the dock bar.
124. You can touch an icon on the dock bar to remove it. The removed icon will be displayed on the home screen again.
13
14### Constraints
15
16This sample can only be run on standard-system devices.
17
18

README_zh.md

1# 拖拽事件
2
3### 介绍
4
5本示例主要展示了拖拽操作的功能。实际效果如下:
6
7### 效果预览
8|               主页              |
9|--------------------------------|
10|![](screenshots/devices/main.png)|
11
12使用说明
13
141.按住桌面图标进行拖拽可以与桌面其他图标交换位置。
15
162.按住桌面图标可以拖拽至底部Dock栏任意位置。
17
183.按住底部Dock栏图标进行拖拽可以与Dock栏其他图标交换位置。
19
204.点击底部Dock栏图标可以进行移除,移除的图标可以返回到桌面上。
21
22### 工程目录
23```
24entry/src/main/ets/MainAbility
25|---app.ets
26|---model
27|   |---HiLogUtil.ets                   // 输出打印
28|   |---IconData.ets                    // 图标数据
29|---pages
30|   |---Index.ets                       // 首页数据展示
31```
32
33### 具体实现
34
35* 本模块提供了界面元素拖拽的功能。
36
37* 创建IconData文件定义图标,源码参考:[IconData.ets](entry/src/main/ets/MainAbility/model/IconData.ets)整改
38
39* onDragStart,onDrop拖拽事件方法实现图标的拖拽
40
41### 相关权限
42
43不涉及。
44
45### 依赖
46
47不涉及。
48
49### 约束与限制
50
511.本示例仅支持在标准系统上运行。
52
532.本示例已适配API version 9版本SDK,版本号:3.2.11.9。
54
553.本示例需要使用DevEco Studio 3.1 Beta2 (Build Version: 3.1.0.400, built on April 7, 2023)才可编译运行。
56
57### 下载
58
59如需单独下载本工程,执行如下命令:
60```
61git init
62git config core.sparsecheckout true
63echo /code/UI/ArkTsComponentCollection/Drag > .git/info/sparse-checkout
64git remote add origin https://gitee.com/openharmony/applications_app_samples.git
65git pull origin master
66```