鸿蒙OS开发文档 鸿蒙OS StylusEvent

2024-02-25 开发教程 鸿蒙OS开发文档 匿名 2

StylusEvent

java.lang.Object
|---ohos.multimodalinput.event.MultimodalEvent
|---|---ohos.multimodalinput.event.ManipulationEvent
|---|---|---ohos.multimodalinput.event.StylusEvent

public abstract class StylusEvent
extends ManipulationEvent

报告触控笔事件。

报告的事件包含按钮状态更改和触控笔操作(按下、滑动或抬起)等信息。 目前,一个事件仅支持一个触控笔动作。

Since:

5

嵌套类摘要

从接口 ohos.utils.Sequenceable 继承的嵌套类/接口
Sequenceable.ProducerT

字段摘要

修饰符和类型字段描述
static intBUTTON_PRESS表示触控笔按下按钮。
static intBUTTON_RELEASE表示触控笔抬起一个按钮。
static intFIRST_BUTTON指示触控笔事件中的按钮状态更改。
static intNONE表示手写笔不对屏幕进行任何操作。
static intNONE_BUTTON指示触控笔事件中没有按钮状态更改。
static intSTYLUS_DOWN表示触控笔按在屏幕上。
static intSTYLUS_MOVE表示触控笔在屏幕上滑动。
static intSTYLUS_UP表示触控笔从屏幕上抬起。
从类 ohos.multimodalinput.event.ManipulationEvent 继承的字段
PHASE_CANCEL, PHASE_COMPLETED, PHASE_MOVE, PHASE_NONE, PHASE_START
从类 ohos.multimodalinput.event.MultimodalEvent 继承的字段
BUILTIN_KEY, DEFAULT_TYPE, highLevelEvent, KEYBOARD, MOUSE, ROTATION, SPEECH, STYLUS, TOUCH_PANEL, UNSUPPORTED_DEVICE, uuid

构造函数摘要

构造函数描述
StylusEvent()

方法总结

修饰符和类型方法描述
abstract intgetAction()获取触控笔动作。
abstract intgetButtons()获取手写笔的按钮状态变化。
从类 ohos.multimodalinput.event.ManipulationEvent 继承的方法
getForce, getPhase, getPointerCount, getPointerId, getPointerPosition, getPointerScreenPosition, getRadius, getStartTime, setScreenOffset
从类 ohos.multimodalinput.event.MultimodalEvent 继承的方法
getDeviceId, getInputDeviceId, getOccurredTime, getSourceDevice, getUuid, isSameEvent, marshalling, unmarshalling
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口 ohos.utils.Sequenceable 继承的方法
hasFileDescriptor

字段详细信息

BUTTON_PRESS

public static final int BUTTON_PRESS

表示触控笔按下按钮。

Since:

5

BUTTON_RELEASE

public static final int BUTTON_RELEASE

表示触控笔抬起一个按钮。

Since:

5

FIRST_BUTTON

public static final int FIRST_BUTTON

指示触控笔事件中的按钮状态更改。

Since:

5

NONE

public static final int NONE

表示手写笔不对屏幕进行任何操作。

Since:

5

NONE_BUTTON

public static final int NONE_BUTTON

指示触控笔事件中没有按钮状态更改。

Since:

5

STYLUS_DOWN

public static final int STYLUS_DOWN

表示触控笔按在屏幕上。

Since:

5

STYLUS_MOVE

public static final int STYLUS_MOVE

表示触控笔在屏幕上滑动。

Since:

5

STYLUS_UP

public static final int STYLUS_UP

表示触控笔从屏幕上抬起。

Since:

5

构造函数详细信息

StylusEvent

public StylusEvent()

方法详情

getAction

public abstract int getAction()

获取触控笔动作。

返回:

返回触控笔动作。 返回值可以是 BUTTON_PRESS、BUTTON_RELEASE、STYLUS_DOWN、STYLUS_MOVE 或 STYLUS_UP。

Since:

5

getButtons

public abstract int getButtons()

获取手写笔的按钮状态变化。

返回:

返回手写笔的按钮状态更改。 返回值可以是 FIRST_BUTTON 或 NONE_BUTTON。

Since:

5