openharmony 鸿蒙 ts-text-common-sys

2026-08-25 浏览 (1)

Text Component Common APIs (System API)

This topic covers the common APIs of text components.

NOTE

The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.

This topic describes only the system APIs provided by the module. For details about its public APIs, see Basic Types and Text Component Common APIs.

TextContentControllerBase

Represents the base controller for TextInput, TextArea, and Search components.

Atomic service API: This API can be used in atomic services since API version 11.

System capability: SystemCapability.ArkUI.ArkUI.Full

getText19+

getText(range?: TextRange): string

Obtains the text content within a specified range.

Atomic service API: This API can be used in atomic services since API version 19.

System API: This is a system API.

System capability: SystemCapability.ArkUI.ArkUI.Full

Parameters

NameTypeMandatoryDescription
rangeTextRangeNoRange of the text content to obtain, defined by start and end positions.
If the range is not specified, the entire text is obtained by default. If the start position is not specified, it defaults to index 0. If the end position is not specified, it defaults to the end of the text.

Return value

TypeDescription
stringText content within the specified range.

KeyboardGradientMode20+

Enumerates keyboard gradient effects.

System API: This is a system API.

System capability: SystemCapability.ArkUI.ArkUI.Full

NameValueDescription
NONE0No gradient effect.
LINEAR_GRADIENT1Linear gradient effect.

KeyboardFluidLightMode20+

Enumerates keyboard fluid lighting effects.

System API: This is a system API.

System capability: SystemCapability.ArkUI.ArkUI.Full

NameValueDescription
NONE0No fluid lighting effect.
BACKGROUND_FLUID_LIGHT1Background fluid lighting effect enabled.

KeyboardAppearanceConfig20+

Describes the keyboard visual style configuration.

System API: This is a system API.

System capability: SystemCapability.ArkUI.ArkUI.Full

NameTypeRead-OnlyOptionalDescription
gradientModeKeyboardGradientModeNoYesKeyboard gradient effect.
Default value: KeyboardGradientMode.NONE
fluidLightModeKeyboardFluidLightModeNoYesKeyboard fluid lighting effect.
Default value: KeyboardFluidLightMode.NONE

TextChangeReason20+

Enumerates the reasons for component content changes.

System API: This is a system API.

System capability: SystemCapability.ArkUI.ArkUI.Full

NameValueDescription
UNKNOWN0Unknown reason.
INPUT1User input.
PASTE2Paste operation.
CUT3Cut operation.
DRAG4Drag and drop operation.
AUTO_FILL5Auto-fill operation.
AI_WRITE6AI-assisted writing.
REDO7Redo operation.
UNDO8Undo operation.
CONTROLLER9Component API call.
ACCESSIBILITY10Accessibility API.
COLLABORATION11Cross-device photographing.
STYLUS12Stylus input.

VoiceButtonOptions23+

Sets the voice button options.

Atomic service API: This API can be used in atomic services since API version 23.

System API: This is a system API.

System capability: SystemCapability.ArkUI.ArkUI.Full

Model restriction: This API can be used only in the stage model.

NameTypeRead-OnlyOptionalDescription
enabledbooleanNoYesWhether to enable or disable the voice button for the input box.
true: The voice button is enabled. false: The voice button is disabled.
Default value: false

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 ts-drawing-components-shape

openharmony 鸿蒙 ts-universal-attributes-sharp-clipping

openharmony 鸿蒙 ts-universal-attributes-toolbar

openharmony 鸿蒙 ts-container-lazyvgridlayout

openharmony 鸿蒙 ohos-arkui-advanced-FoldSplitContainer

openharmony 鸿蒙 ts-methods-calendarpicker-dialog

openharmony 鸿蒙 ts-uicommonevent

openharmony 鸿蒙 ts-basic-gestures-tapgesture

openharmony 鸿蒙 ohos-arkui-advanced-DialogV2

openharmony 鸿蒙 ts-components-canvas-canvas

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/QlqGMYF7