共用方式為


AccessibilityNodeInfo Class

Definition

This class represents a node of the window content as well as actions that can be requested from its source.

[Android.Runtime.Register("android/view/accessibility/AccessibilityNodeInfo", DoNotGenerateAcw=true)]
public class AccessibilityNodeInfo : Java.Lang.Object, Android.OS.IParcelable, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/view/accessibility/AccessibilityNodeInfo", DoNotGenerateAcw=true)>]
type AccessibilityNodeInfo = class
    inherit Object
    interface IParcelable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
AccessibilityNodeInfo
Attributes
Implements

Remarks

This class represents a node of the window content as well as actions that can be requested from its source. From the point of view of an android.accessibilityservice.AccessibilityService a window's content is presented as a tree of accessibility node infos, which may or may not map one-to-one to the view hierarchy. In other words, a custom view is free to report itself as a tree of accessibility node info. </p>

Once an accessibility node info is delivered to an accessibility service it is made immutable and calling a state mutation method generates an error. See #setQueryFromAppProcessEnabled if you would like to inspect the node tree from the app process for testing or debugging tools.

Please refer to android.accessibilityservice.AccessibilityService for details about how to obtain a handle to window content as a tree of accessibility node info as well as details about the security model.

<div class="special reference"> <h3>Developer Guides</h3>

For more information about making applications accessible, read the Accessibility developer guide.

</div>

Java documentation for android.view.accessibility.AccessibilityNodeInfo.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

AccessibilityNodeInfo()

Creates a new AccessibilityNodeInfo.

AccessibilityNodeInfo(AccessibilityNodeInfo)

Copy constructor.

AccessibilityNodeInfo(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

AccessibilityNodeInfo(View, Int32)

Creates a new AccessibilityNodeInfo with the given source.

AccessibilityNodeInfo(View)

Creates a new AccessibilityNodeInfo with the given source.

Fields

ActionAccessibilityFocus
Obsolete.

Action that gives accessibility focus to the node.

ActionArgumentColumnInt

Argument for specifying the collection column to make visible on screen.

ActionArgumentDirectionInt

Argument to represent the direction when using AccessibilityAction#ACTION_SCROLL_IN_DIRECTION.

ActionArgumentExtendSelectionBoolean

Argument for whether when moving at granularity to extend the selection or to move it otherwise.

ActionArgumentHtmlElementString

Argument for which HTML element to get moving to the next/previous HTML element.

ActionArgumentMovementGranularityInt

Argument for which movement granularity to be used when traversing the node text.

ActionArgumentMoveWindowX

Argument for specifying the x coordinate to which to move a window.

ActionArgumentMoveWindowY

Argument for specifying the y coordinate to which to move a window.

ActionArgumentPressAndHoldDurationMillisInt

Argument to represent the duration in milliseconds to press and hold a node.

ActionArgumentProgressValue

Argument for specifying the progress value to set.

ActionArgumentRowInt

Argument for specifying the collection row to make visible on screen.

ActionArgumentSelectionEndInt

Argument for specifying the selection end.

ActionArgumentSelectionStartInt

Argument for specifying the selection start.

ActionArgumentSetTextCharsequence

Argument for specifying the text content to set.

ActionClearAccessibilityFocus
Obsolete.

Action that clears accessibility focus of the node.

ActionClearFocus
Obsolete.

Action that clears input focus of the node.

ActionClearSelection
Obsolete.

Action that deselects the node.

ActionClick
Obsolete.

Action that clicks on the node info.

ActionCollapse
Obsolete.

Action to collapse an expandable node.

ActionCopy
Obsolete.

Action to copy the current selection to the clipboard.

ActionCut
Obsolete.

Action to cut the current selection and place it to the clipboard.

ActionDismiss
Obsolete.

Action to dismiss a dismissable node.

ActionExpand
Obsolete.

Action to expand an expandable node.

ActionFocus
Obsolete.

Action that gives input focus to the node.

ActionLongClick
Obsolete.

Action that long clicks on the node.

ActionNextAtMovementGranularity
Obsolete.

Action that requests to go to the next entity in this node's text at a given movement granularity.

ActionNextHtmlElement
Obsolete.

Action to move to the next HTML element of a given type.

ActionPaste
Obsolete.

Action to paste the current clipboard content.

ActionPreviousAtMovementGranularity
Obsolete.

Action that requests to go to the previous entity in this node's text at a given movement granularity.

ActionPreviousHtmlElement
Obsolete.

Action to move to the previous HTML element of a given type.

ActionScrollBackward
Obsolete.

Action to scroll the node content backward.

ActionScrollForward
Obsolete.

Action to scroll the node content forward.

ActionSelect
Obsolete.

Action that selects the node.

ActionSetSelection
Obsolete.

Action to set the selection.

ActionSetText
Obsolete.

Action that sets the text of the node.

ExtraDataRenderingInfoKey

Key used to request extra data for the rendering information.

ExtraDataTextCharacterLocationArgLength

Integer argument specifying the end index of the requested text location data.

ExtraDataTextCharacterLocationArgMaxLength

The maximum allowed length of the requested text location data.

ExtraDataTextCharacterLocationArgStartIndex

Integer argument specifying the start index of the requested text location data.

ExtraDataTextCharacterLocationKey

Key used to request and locate extra data for text character location.

FlagPrefetchAncestors
Obsolete.

Prefetching strategy that prefetches the ancestors of the requested node.

FlagPrefetchDescendantsBreadthFirst
Obsolete.

Prefetching strategy that prefetches the descendants of the requested node breadth-first.

FlagPrefetchDescendantsDepthFirst
Obsolete.

Prefetching strategy that prefetches the descendants of the requested node depth-first.

FlagPrefetchDescendantsHybrid
Obsolete.

Prefetching strategy that prefetches the descendants in a hybrid depth first and breadth first approach.

FlagPrefetchSiblings
Obsolete.

Prefetching strategy that prefetches the siblings of the requested node.

FlagPrefetchUninterruptible
Obsolete.

Prefetching flag that specifies prefetching should not be interrupted by a request to retrieve a node or perform an action on a node.

FocusAccessibility
Obsolete.

The accessibility focus.

FocusInput
Obsolete.

The input focus.

MaxNumberOfPrefetchedNodes

Maximum batch size of prefetched nodes for a request.

MovementGranularityCharacter
Obsolete.

Movement granularity bit for traversing the text of a node by character.

MovementGranularityLine
Obsolete.

Movement granularity bit for traversing the text of a node by line.

MovementGranularityPage
Obsolete.

Movement granularity bit for traversing the text of a node by page.

MovementGranularityParagraph
Obsolete.

Movement granularity bit for traversing the text of a node by paragraph.

MovementGranularityWord
Obsolete.

Movement granularity bit for traversing the text of a node by word.

Properties

AccessibilityDataSensitive

Gets if the node's accessibility data is considered sensitive. -or- Sets whether this node's accessibility data is considered sensitive.

AccessibilityFocused

Gets whether this node is accessibility focused. -or- Sets whether this node is accessibility focused.

ActionList

Gets the actions that can be performed on the node.

Actions
Obsolete.

Gets the actions that can be performed on the node.

AvailableExtraData

Get the extra data available for this node. -or- Set the extra data available for this node.

Checkable

Gets whether this node is checkable. -or- Sets whether this node is checkable.

Checked

Gets whether this node is checked. -or- Sets whether this node is checked.

ChildCount

Gets the number of children.

Class

Returns the runtime class of this Object.

(Inherited from Object)
ClassName
ClassNameFormatted

Gets the class this node comes from. -or- Sets the class this node comes from.

Clickable

Gets whether this node is clickable. -or- Sets whether this node is clickable.

ContainerTitle
ContainerTitleFormatted

Returns the container title. -or- Sets the container title for app-developer-defined container which can be any type of ViewGroup or layout.

ContentDescription
ContentDescriptionFormatted

Gets the content description of this node. -or- Sets the content description of this node.

ContentInvalid

Gets if the content of this node is invalid. -or- Sets if the content of this node is invalid.

ContextClickable

Gets whether this node is context clickable. -or- Sets whether this node is context clickable.

Creator
Dismissable

Gets if the node can be dismissed. -or- Sets if the node can be dismissed.

DrawingOrder

Get the drawing order of the view corresponding it this node. -or- Set the drawing order of the view corresponding it this node.

Editable

Gets if the node is editable. -or- Sets whether this node is editable.

Enabled

Gets whether this node is enabled. -or- Sets whether this node is enabled.

Error
ErrorFormatted

Gets the error text of this node. -or- Sets the error text of this node.

Extras

Gets an optional bundle with extra data.

Focusable

Gets whether this node is focusable. -or- Sets whether this node is focusable.

Focused

Gets whether this node is focused. -or- Sets whether this node is focused.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
HasRequestInitialAccessibilityFocus

Gets whether the node has #setRequestInitialAccessibilityFocus.

Heading

Returns whether node represents a heading. -or- Sets whether the node represents a heading.

HintText
HintTextFormatted

Gets the hint text of this node. -or- Sets the hint text of this node.

ImportantForAccessibility

Returns whether the node originates from a view considered important for accessibility. -or- Sets whether the node is considered important for accessibility.

InputType

Gets the input type of the source as defined by InputType. -or- Sets the input type of the source as defined by InputType.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
LabeledBy

Gets the node info which serves as the label of the view represented by this info for accessibility purposes.

LabelFor

Gets the node info for which the view represented by this info serves as a label for accessibility purposes.

LiveRegion

Gets the node's live region mode. -or- Sets the node's live region mode.

LongClickable

Gets whether this node is long clickable. -or- Sets whether this node is long clickable.

MaxTextLength

Returns the maximum text length for this node. -or- Sets the maximum text length, or -1 for no limit.

MinDurationBetweenContentChanges

Gets the minimum time duration between two content change events. -or- Sets the minimum time duration between two content change events, which is used in throttling content change events in accessibility services.

MovementGranularities

Gets the movement granularities for traversing the text of this node. -or- Sets the movement granularities for traversing the text of this node.

MultiLine

Gets if the node is a multi line editable text. -or- Sets if the node is a multi line editable text.

PackageName
PackageNameFormatted

Gets the package this node comes from. -or- Sets the package this node comes from.

PaneTitle
PaneTitleFormatted

Get the title of the pane represented by this node. -or- If this node represents a visually distinct region of the screen that may update separately from the rest of the window, it is considered a pane.

Parent

Gets the parent.

Password

Gets whether this node is a password. -or- Sets whether this node is a password.

PeerReference (Inherited from Object)
ScreenReaderFocusable

Returns whether the node is explicitly marked as a focusable unit by a screen reader. -or- Sets whether the node should be considered a focusable unit by a screen reader.

Scrollable

Gets if the node is scrollable. -or- Sets if the node is scrollable.

Selected

Gets whether this node is selected. -or- Sets whether this node is selected.

ShowingHintText

Returns whether the node's text represents a hint for the user to enter text. -or- Sets whether the node's text represents a hint for the user to enter text.

StateDescription
StateDescriptionFormatted

Get the state description of this node. -or- Sets the state description of this node.

Text
TextEntryKey

Returns whether node represents a text entry key that is part of a keyboard or keypad. -or- Sets whether the node represents a text entry key that is part of a keyboard or keypad.

TextFormatted

Gets the text of this node. -or- Sets the text of this node.

TextSelectable

Gets if the node has selectable text. -or- Sets if the node has selectable text.

TextSelectionEnd

Gets the text selection end if text is selected.

TextSelectionStart

Gets the text selection start or the cursor position.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

TooltipText
TooltipTextFormatted

Gets the tooltip text of this node. -or- Sets the tooltip text of this node.

TraversalAfter

Gets the node after which this one is visited in accessibility traversal.

TraversalBefore

Gets the node before which this one is visited during traversal.

UniqueId

Gets the unique id of the node. -or- Sets the unique id to act as a key to identify the node.

ViewIdResourceName

Gets the fully qualified resource name of the source view's id. -or- Sets the fully qualified resource name of the source view's id.

VisibleToUser

Gets whether this node is visible to the user. -or- Sets whether this node is visible to the user.

Window

Gets the window to which this node belongs.

WindowId

Gets the id of the window from which the info comes from.

Methods

AddAction(AccessibilityNodeInfo+AccessibilityAction)

Adds an action that can be performed on the node.

AddAction(Action)
Obsolete.

Adds an action that can be performed on the node.

AddChild(View, Int32)

Adds a virtual child which is a descendant of the given root.

AddChild(View)

Adds a child.

CanOpenPopup()

Gets if this node opens a popup or a dialog.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
DescribeContents()

To be added

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
FindAccessibilityNodeInfosByText(String)

Finds AccessibilityNodeInfos by text.

FindAccessibilityNodeInfosByViewId(String)

Finds AccessibilityNodeInfos by the fully qualified view id's resource name where a fully qualified id is of the from "package:id/id_resource_name".

FindFocus(NodeFocus)

Find the view that has the specified focus type.

FocusSearch(FocusSearchDirection)

Searches for the nearest view in the specified direction that can take the input focus.

GetBoundsInParent(Rect)

Gets the node bounds in the viewParent's coordinates.

GetBoundsInScreen(Rect)

Gets the node bounds in screen coordinates.

GetBoundsInWindow(Rect)

Gets the node bounds in window coordinates.

GetChild(Int32, Int32)

Get the child at given index.

GetChild(Int32)

Get the child at given index.

GetCollectionInfo()

Gets the collection info if the node is a collection.

GetCollectionItemInfo()

Gets the collection item info if the node is a collection item.

GetExtraRenderingInfo()

Gets the ExtraRenderingInfo extra rendering info if the node is meant to be refreshed with extra data to examine rendering related accessibility issues.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetParent(Int32)

Gets the parent.

GetRangeInfo()

Gets the range info if this node is a range.

GetTouchDelegateInfo()

Get the TouchDelegateInfo for touch delegate behavior with the represented view.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
Obtain()

Instantiates a new AccessibilityNodeInfo.

Obtain(AccessibilityNodeInfo)

Instantiates a new AccessibilityNodeInfo initialized from the given info.

Obtain(View, Int32)

Returns a cached instance if such is available otherwise a new one and sets the source.

Obtain(View)

Returns a cached instance if such is available otherwise a new one and sets the source.

PerformAction(Action, Bundle)

Performs an action on the node.

PerformAction(Action)

Performs an action on the node.

Recycle()

Would previously return an instance back to be reused.

Refresh()

Refreshes this info with the latest state of the view it represents.

RefreshWithExtraData(String, Bundle)

Refreshes this info with the latest state of the view it represents, and request new data be added by the View.

RemoveAction(AccessibilityNodeInfo+AccessibilityAction)

Removes an action that can be performed on the node.

RemoveAction(Int32)
Obsolete.

Removes an action that can be performed on the node.

RemoveChild(View, Int32)

Removes a virtual child which is a descendant of the given root.

RemoveChild(View)

Removes a child.

SetBoundsInParent(Rect)

Sets the node bounds in the viewParent's coordinates.

SetBoundsInScreen(Rect)

Sets the node bounds in screen coordinates.

SetBoundsInWindow(Rect)

Sets the node bounds in window coordinates.

SetCanOpenPopup(Boolean)

Sets if this node opens a popup or a dialog.

SetCollectionInfo(AccessibilityNodeInfo+CollectionInfo)

Sets the collection info if the node is a collection.

SetCollectionItemInfo(AccessibilityNodeInfo+CollectionItemInfo)

Sets the collection item info if the node is a collection item.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetLabeledBy(View, Int32)

Sets the view which serves as the label of the view represented by this info for accessibility purposes.

SetLabeledBy(View)

Sets the view which serves as the label of the view represented by this info for accessibility purposes.

SetLabelFor(View, Int32)

Sets the view for which the view represented by this info serves as a label for accessibility purposes.

SetLabelFor(View)

Sets the view for which the view represented by this info serves as a label for accessibility purposes.

SetParent(View, Int32)

Sets the parent to be a virtual descendant of the given root.

SetParent(View)

Sets the parent.

SetQueryFromAppProcessEnabled(View, Boolean)

Connects this node to the View's root so that operations on this node can query the entire AccessibilityNodeInfo tree and perform accessibility actions on nodes.

SetRangeInfo(AccessibilityNodeInfo+RangeInfo)

Sets the range info if this node is a range.

SetRequestInitialAccessibilityFocus(Boolean)

Sets whether the node has requested initial accessibility focus.

SetSource(View, Int32)

Sets the source to be a virtual descendant of the given root.

SetSource(View)

Sets the source.

SetTextSelection(Int32, Int32)

Sets the text selection start and end.

SetTouchDelegateInfo(AccessibilityNodeInfo+TouchDelegateInfo)

Set touch delegate info if the represented view has a TouchDelegate.

SetTraversalAfter(View, Int32)

Sets the node after which this one is visited in accessibility traversal.

SetTraversalAfter(View)

Sets the view whose node is visited after this one in accessibility traversal.

SetTraversalBefore(View, Int32)

Sets the node before which this one is visited during traversal.

SetTraversalBefore(View)

Sets the view before whose node this one should be visited during traversal.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
WriteToParcel(Parcel, ParcelableWriteFlags)

To be added

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to