您的位置:58编程 > 鸿蒙系统 鸿蒙OS Component.DraggedListener

鸿蒙系统 鸿蒙OS Component.DraggedListener

2023-04-08 13:33 鸿蒙OS开发文档

鸿蒙系统 鸿蒙OS Component.DraggedListener

鸿蒙系统 鸿蒙OS Component.DraggedListener

鸿蒙系统

Component.DraggedListener

public static interface Component.DraggedListener

提供当手势识别器将拖动事件分派到组件时要调用的回调。

方法总结

修饰符和类型 方法 描述
void onDragCancel(Component component, DragInfo dragInfo) 处理分派给组件的拖动取消事件。
void onDragDown(Component component, DragInfo dragInfo) 处理分派给组件的下拉事件。
void onDragEnd(Component component, DragInfo dragInfo) 处理分派给组件的拖动结束事件。
default boolean onDragPreAccept(Component component, int dragDirection) 接受分派给组件的拖动事件。
void onDragStart(Component component, DragInfo dragInfo) 处理分派给组件的拖动开始事件。
void onDragUpdate(Component component, DragInfo dragInfo) 处理分派给组件的拖动更新事件。

方法详情

onDragDown

void onDragDown(Component component, DragInfo dragInfo)

处理分派给组件的下拉事件。

参数:

参数名称 参数描述
component 指示拖拽事件被调度到的组件。
dragInfo 指示下拉信息对象 DragInfo。

onDragStart

void onDragStart(Component component, DragInfo dragInfo)

处理分派给组件的拖动开始事件。

参数:

参数名称 参数描述
component 指示拖动开始事件被调度到的组件。
dragInfo 指示拖动开始信息对象 DragInfo。

onDragUpdate

void onDragUpdate(Component component, DragInfo dragInfo)

处理分派给组件的拖动更新事件。

参数:

参数名称 参数描述
component 指示拖动更新事件被调度到的组件。
dragInfo 指示拖动更新信息对象 DragInfo。

onDragEnd

void onDragEnd(Component component, DragInfo dragInfo)

处理分派给组件的拖动结束事件。

参数:

参数名称 参数描述
component 指示拖拽结束事件被调度到的组件。
dragInfo 表示拖动结束信息对象 DragInfo。

onDragCancel

void onDragCancel(Component component, DragInfo dragInfo)

处理分派给组件的拖动取消事件。

参数:

参数名称 参数描述
component 指示拖拽结束事件被调度到的组件。
dragInfo 表示拖动结束信息对象 DragInfo。

onDragPreAccept

default boolean onDragPreAccept(Component component, int dragDirection)

接受分派给组件的拖动事件。

此方法支持 Component.DRAG_HORIZONTAL、Component.DRAG_VERTICAL 和 Component.DRAG_HORIZONTAL_VERTICAL。 当设置了 Component.DRAG_HORIZONTAL_VERTICAL 时,拖动方向可能会比较粗略。

参数:

参数名称 参数描述
component 指示拖动事件被调度到的组件。
dragDirection 指示拖动方向,可以是 Component.DRAG_UP、Component.DRAG_DOWN、Component.DRAG_LEFT 或 Component.DRAG_RIGHT。

返回:

如果当前拖动事件被接受,则返回 true(默认值); 否则返回 false。

阅读全文
以上是58编程为你收集整理的鸿蒙系统 鸿蒙OS Component.DraggedListener全部内容。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。
相关文章
© 2024 58编程 58biancheng.com 版权所有 联系我们
桂ICP备12005667号-32 Powered by CMS