public class AccessibilityInfo extends Object
The information about this accessibility node derives from a HarmonyOS application control. You can use this accessibility node to obtain information about the control on the GUI.
SystemCapability.Accessibility#ABILITY| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
ACCESSIBILITY_OPERATION_ACCESSIBILITY_FOCUS |
Indicates the operation of gaining accessibility focus.
|
static int |
ACCESSIBILITY_OPERATION_CLEAR_ACCESSIBILITY_FOCUS |
Indicates the operation of clearing accessibility focus.
|
static int |
ACCESSIBILITY_OPERATION_CLEAR_FOCUS |
Indicates the operation of clearing focus.
|
static int |
ACCESSIBILITY_OPERATION_CLEAR_SELECTION |
Indicates the operation of deselecting an accessibility node.
|
static int |
ACCESSIBILITY_OPERATION_CLICK |
Indicates the click operation.
|
static int |
ACCESSIBILITY_OPERATION_COPY |
Indicates the copy operation.
|
static int |
ACCESSIBILITY_OPERATION_CUT |
Indicates the cut operation.
|
static int |
ACCESSIBILITY_OPERATION_FOCUS |
Indicates the operation of gaining focus.
|
static int |
ACCESSIBILITY_OPERATION_LONG_CLICK |
Indicates the long click operation.
|
static int |
ACCESSIBILITY_OPERATION_PASTE |
Indicates the paste operation.
|
static int |
ACCESSIBILITY_OPERATION_SCROLL_BACKWARD |
Indicates the operation of scrolling backwards.
|
static int |
ACCESSIBILITY_OPERATION_SCROLL_FORWARD |
Indicates the operation of scrolling forwards.
|
static int |
ACCESSIBILITY_OPERATION_SELECT |
Indicates the operation of selecting an accessibility node.
|
static int |
ACCESSIBILITY_OPERATION_SET_SELECTION |
Indicates the operation of selecting text.
|
static int |
ACCESSIBILITY_OPERATION_SET_TEXT |
Indicates the operation of setting text.
|
static int |
DIRECTION_BACKWARD |
Indicates the backward direction.
|
static int |
DIRECTION_DOWN |
Indicates the downward direction.
|
static int |
DIRECTION_FORWARD |
Indicates the forward direction.
|
static int |
DIRECTION_LEFT |
Indicates the leftward direction.
|
static int |
DIRECTION_RIGHT |
Indicates the rightward direction.
|
static int |
DIRECTION_UP |
Indicates the upward direction.
|
static int |
FOCUS_TYPE_ACCESSIBILITY |
Indicates the type of accessibility focus.
|
static int |
FOCUS_TYPE_INPUT |
Indicates the type of input focus.
|
| 构造器 | 说明 |
|---|---|
AccessibilityInfo() |
Constructor
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
addOperation(AccessibleOperation operation) |
Adds an operation.
|
boolean |
deleteOperation(AccessibleOperation operation) |
Deletes an operation.
|
boolean |
executeOperation(int operation) |
Executes a specified operation.
|
Optional<AccessibilityInfo> |
gainFocus(int focusType) |
Obtains information about the node that gains accessibility focus.
|
Optional<AccessibilityInfo> |
gainNextFocus(int direction) |
Obtains the next focused node in the specified direction of the currently focused node.
|
long |
getAccessibilityId() |
Obtains the ID of this accessibility node.
|
List<AccessibilityInfo> |
getAccessibleInfoViaContent(String text) |
Searches for node information based on the specified content.
|
CharSequence |
getBundleName() |
Obtains the application bundle name.
|
Optional<AccessibilityInfo> |
getChild(int index) |
Obtains information about the child node at a specified index.
|
int |
getChildCount() |
Obtains the number of child nodes.
|
long |
getChildId(int index) |
Obtains the ID of the child node at a specified index.
|
String |
getClassName() |
Obtains the class name.
|
String |
getComponentResourceId() |
Obtains the resource ID.
|
CharSequence |
getContent() |
Obtains the node content.
|
CharSequence |
getDescriptionInfo() |
Obtains the description of the accessibility node.
|
String |
getHint() |
Obtains the hint information.
|
int |
getMaximumLength() |
Obtains the maximum length of text allowed for this node.
|
List<AccessibleOperation> |
getOperations() |
Obtains an operation list.
|
Rect |
getRectInScreen() |
Obtains the rectangular area of this accessibility node control in the screen.
|
boolean |
hasGainedAccessibilitySelected() |
Checks whether this node has gained accessibility focus.
|
boolean |
isCheckable() |
Checks whether this node (a check box as an example) is checkable.
|
boolean |
isChecked() |
Checks whether this node is checked.
|
boolean |
isClickable() |
Checks whether this node is clickable.
|
boolean |
isDeletable() |
Checks whether this node is deletable.
|
boolean |
isEditable() |
Checks whether this node is editable.
|
boolean |
isEnabled() |
Checks whether this node is enabled.
|
boolean |
isEssential() |
Checks whether this node is essential to users.
|
boolean |
isFocusable() |
Checks whether this node can be focused.
|
boolean |
isFocused() |
Checks whether this node has gained focus.
|
boolean |
isGivingHint() |
Checks whether this node is displaying a hint.
|
boolean |
isLongClickable() |
Checks whether this node supports the long click operation.
|
boolean |
isPassword() |
Checks whether the content in this node is a password.
|
boolean |
isPluralLineSupported() |
Checks whether this node can display text in multiple lines.
|
boolean |
isPopupSupported() |
Checks whether pop-up windows are supported.
|
boolean |
isScrollable() |
Checks whether this node is scrollable.
|
boolean |
isSelected() |
Checks whether this node is selected.
|
boolean |
isVisible() |
Checks whether this node is visible to users.
|
void |
setAccessibleFocusStatus(boolean accessibilityFocused) |
Sets whether this node is accessibility focused.
|
void |
setCheckable(boolean checkable) |
Sets whether this node is checkable.
|
void |
setChecked(boolean checked) |
Sets whether this node is checked.
|
void |
setClassName(String className) |
Sets the class name.
|
void |
setClickable(boolean clickable) |
Sets whether this node is clickable.
|
void |
setDeletable(boolean dismissible) |
Sets whether this node is deletable.
|
void |
setEditable(boolean editable) |
Sets whether this node is editable.
|
void |
setEnabled(boolean enabled) |
Sets whether this node is enabled.
|
void |
setEssential(boolean essential) |
Sets whether this node is essential to users.
|
void |
setFocusable(boolean focusable) |
Sets whether this node can be focused.
|
void |
setFocused(boolean focused) |
Sets whether this node has gained focus.
|
void |
setHint(String hint) |
Sets the hint information.
|
void |
setHinting(boolean givingHintText) |
Sets whether this node is displaying a hint.
|
void |
setLongClickable(boolean longClickable) |
Sets whether this node supports the long click operation.
|
void |
setMaximumLength(int maxLength) |
Sets the maximum length of text allowed for this node.
|
void |
setPassword(boolean password) |
Sets whether the content in this node is a password.
|
void |
setPluralLineSupported(boolean pluralLineSupported) |
Sets whether this node can display text in multiple lines.
|
void |
setPopupSupported(boolean supportPopup) |
Sets whether to support pop-up windows.
|
void |
setScrollable(boolean scrollable) |
Sets whether this node is scrollable.
|
void |
setSelected(boolean selected) |
Sets whether this node is selected.
|
void |
setVisible(boolean visibleToUser) |
Sets whether this node is visible to users.
|
public static final int ACCESSIBILITY_OPERATION_ACCESSIBILITY_FOCUS
public static final int ACCESSIBILITY_OPERATION_CLEAR_ACCESSIBILITY_FOCUS
public static final int ACCESSIBILITY_OPERATION_CLEAR_FOCUS
public static final int ACCESSIBILITY_OPERATION_CLEAR_SELECTION
public static final int ACCESSIBILITY_OPERATION_CLICK
public static final int ACCESSIBILITY_OPERATION_COPY
public static final int ACCESSIBILITY_OPERATION_CUT
public static final int ACCESSIBILITY_OPERATION_FOCUS
public static final int ACCESSIBILITY_OPERATION_LONG_CLICK
public static final int ACCESSIBILITY_OPERATION_PASTE
public static final int ACCESSIBILITY_OPERATION_SCROLL_BACKWARD
public static final int ACCESSIBILITY_OPERATION_SCROLL_FORWARD
public static final int ACCESSIBILITY_OPERATION_SELECT
public static final int ACCESSIBILITY_OPERATION_SET_SELECTION
public static final int ACCESSIBILITY_OPERATION_SET_TEXT
public static final int DIRECTION_BACKWARD
public static final int DIRECTION_DOWN
public static final int DIRECTION_FORWARD
public static final int DIRECTION_LEFT
public static final int DIRECTION_RIGHT
public static final int DIRECTION_UP
public static final int FOCUS_TYPE_ACCESSIBILITY
public static final int FOCUS_TYPE_INPUT
public long getAccessibilityId()
public String getComponentResourceId()
public CharSequence getContent()
public Rect getRectInScreen()
public CharSequence getBundleName()
public CharSequence getDescriptionInfo()
public Optional<AccessibilityInfo> getChild(int index)
index - Indicates the index of the child node.public int getChildCount()
public long getChildId(int index)
index - Indicates the index of the child node.public Optional<AccessibilityInfo> gainFocus(int focusType)
focusType - Indicates the focus type, which is described in
AccessibilityInfo#FOCUS_TYPE_ACCESSIBILITY.public Optional<AccessibilityInfo> gainNextFocus(int direction)
direction - Indicates the direction to obtain the next focused node. The value can be
AccessibilityInfo#DIRECTION_UP, AccessibilityInfo#DIRECTION_DOWN,
AccessibilityInfo#DIRECTION_LEFT, AccessibilityInfo#DIRECTION_RIGHT,
AccessibilityInfo#DIRECTION_FORWARD, or AccessibilityInfo#DIRECTION_BACKWARD.public List<AccessibilityInfo> getAccessibleInfoViaContent(String text)
text - Indicates the content used to search for node information.public boolean executeOperation(int operation)
operation - Indicates the operation type.true if the operation is successfully executed; returns false otherwise.public void addOperation(AccessibleOperation operation)
operation - Indicates the operation type.public List<AccessibleOperation> getOperations()
public boolean deleteOperation(AccessibleOperation operation)
operation - Indicates the operation type.true if the operation is successfully deleted; returns false otherwise.public boolean isPopupSupported()
true if pop-up windows are supported; returns false otherwise.public void setPopupSupported(boolean supportPopup)
supportPopup - Specifies whether to support pop-up windows. The value true indicates that pop-up
windows are supported, and false indicates the opposite.public String getClassName()
public void setClassName(String className)
className - Indicates the class name to set.public String getHint()
public void setHint(String hint)
hint - Indicates the hint information to set.public int getMaximumLength()
public void setMaximumLength(int maxLength)
maxLength - Indicates the maximum length to set.public boolean hasGainedAccessibilitySelected()
true if this node has gained accessibility focus; returns false otherwise.public void setAccessibleFocusStatus(boolean accessibilityFocused)
accessibilityFocused - Specifies whether this node is accessibility focused. The value true
indicates that the node is accessibility focused, and false indicates the opposite.public boolean isCheckable()
true if this node is checkable; returns false otherwise.public void setCheckable(boolean checkable)
checkable - Specifies whether this node is checkable. The value true indicates that the node is
checkable, and false indicates the opposite.public boolean isChecked()
true if this node is checked; returns false otherwise.public void setChecked(boolean checked)
checked - Specifies whether this node is checked. The value true indicates that the node is checked,
and false indicates the opposite.public boolean isClickable()
true if this node is clickable; returns false otherwise.public void setClickable(boolean clickable)
clickable - Specifies whether this node is clickable. The value true indicates that the node is
clickable, and false indicates the opposite.public boolean isDeletable()
true if this node is deletable; returns false otherwise.public void setDeletable(boolean dismissible)
dismissible - Specifies whether this node is deletable. The value true indicates that the node is
deletable, and false indicates the opposite.public boolean isEditable()
true if this node is editable; returns false otherwise.public void setEditable(boolean editable)
editable - Specifies whether this node is editable. The value true indicates that the node is
editable, and false indicates the opposite.public boolean isEnabled()
true if this node is enabled; returns false otherwise.public void setEnabled(boolean enabled)
enabled - Specifies whether this node is enabled. The value true indicates that the node is enabled,
and false indicates the opposite.public boolean isFocused()
true if this node has gained focus; returns false otherwise.public void setFocused(boolean focused)
focused - Specifies whether this node has gained focus. The value true indicates that the node has
gained focus, and false indicates the opposite.public boolean isFocusable()
true if this node can be focused; returns false otherwise.public void setFocusable(boolean focusable)
focusable - Specifies whether this node can be focused. The value true indicates that the node can
be focused, and false indicates the opposite.public boolean isEssential()
true if this node is essential to users; returns false otherwise.public void setEssential(boolean essential)
essential - Specifies whether this node is essential to users. The value true indicates that the
node is essential to users, and false indicates the opposite.public boolean isLongClickable()
true if this node supports long click; returns false otherwise.public void setLongClickable(boolean longClickable)
longClickable - Specifies whether this node supports long click. The value true indicates that the
node supports long click, and false indicates the opposite.public boolean isPluralLineSupported()
true if text can be displayed in multiple lines; returns false otherwise.public void setPluralLineSupported(boolean pluralLineSupported)
pluralLineSupported - Specifies whether this node can display text in multiple lines. The value true
indicates that the node can display text in multiple lines, and false indicates the opposite.public boolean isPassword()
true if the content is a password; returns false otherwise.public void setPassword(boolean password)
password - Specifies whether the content in this node is a password. The value true indicates that
the content is a password, and false indicates the opposite.public boolean isScrollable()
true if this node is scrollable; returns false otherwise.public void setScrollable(boolean scrollable)
scrollable - Specifies whether this node is scrollable. The value true indicates that the node is
scrollable, and false indicates the opposite.public boolean isSelected()
true if this node is selected; returns false otherwise.public void setSelected(boolean selected)
selected - Specifies whether this node is selected. The value true indicates that the node is
selected, and false indicates the opposite.public boolean isGivingHint()
true if this node is displaying a hint; returns false otherwise.public void setHinting(boolean givingHintText)
givingHintText - Specifies whether this node is displaying a hint. The value true indicates that the
node is displaying a hint, and false indicates the opposite.public boolean isVisible()
true if this node is visible to users; returns false otherwise.public void setVisible(boolean visibleToUser)
visibleToUser - Specifies whether this node is visible to users. The value true indicates that the
node is visible to users, and false indicates the opposite.