public class AccessibilityNodeProviderCompat extends Object
AccessibilityNodeProvider
introduced after API level 4 in a backwards compatible fashion.Modifier and Type | Field and Description |
---|---|
static int |
HOST_VIEW_ID
The virtual id for the hosting View.
|
Constructor and Description |
---|
AccessibilityNodeProviderCompat()
Creates a new instance.
|
AccessibilityNodeProviderCompat(Object provider)
Creates a new instance wrapping an
AccessibilityNodeProvider . |
Modifier and Type | Method and Description |
---|---|
AccessibilityNodeInfoCompat |
createAccessibilityNodeInfo(int virtualViewId)
Returns an
AccessibilityNodeInfoCompat representing a virtual view,
i.e. a descendant of the host View, with the given virtualViewId
or the host View itself if virtualViewId equals to HOST_VIEW_ID . |
List<AccessibilityNodeInfoCompat> |
findAccessibilityNodeInfosByText(String text,
int virtualViewId)
Finds
AccessibilityNodeInfoCompat s by text. |
AccessibilityNodeInfoCompat |
findFocus(int focus)
Find the virtual view, i.e. a descendant of the host View, that has the
specified focus type.
|
Object |
getProvider() |
boolean |
performAction(int virtualViewId,
int action,
Bundle arguments)
Performs an accessibility action on a virtual view, i.e. a descendant of the
host View, with the given
virtualViewId or the host View itself
if virtualViewId equals to HOST_VIEW_ID . |
public static final int HOST_VIEW_ID
public AccessibilityNodeProviderCompat()
public AccessibilityNodeProviderCompat(Object provider)
AccessibilityNodeProvider
.provider
- The provider.public Object getProvider()
AccessibilityNodeProvider
.@Nullable public AccessibilityNodeInfoCompat createAccessibilityNodeInfo(int virtualViewId)
AccessibilityNodeInfoCompat
representing a virtual view,
i.e. a descendant of the host View, with the given virtualViewId
or the host View itself if virtualViewId
equals to HOST_VIEW_ID
.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report them selves as a tree of virtual views, thus conveying their logical structure.
The implementer is responsible for obtaining an accessibility node info from the pool of reusable instances and setting the desired properties of the node info before returning it.
virtualViewId
- A client defined virtual view id.AccessibilityNodeInfoCompat
for a virtual descendant
or the host View.AccessibilityNodeInfoCompat
public boolean performAction(int virtualViewId, int action, Bundle arguments)
virtualViewId
or the host View itself
if virtualViewId
equals to HOST_VIEW_ID
.virtualViewId
- A client defined virtual view id.action
- The action to perform.arguments
- Optional arguments.createAccessibilityNodeInfo(int)
,
AccessibilityNodeInfoCompat
@Nullable public List<AccessibilityNodeInfoCompat> findAccessibilityNodeInfosByText(String text, int virtualViewId)
AccessibilityNodeInfoCompat
s by text. The match is case insensitive
containment. The search is relative to the virtual view, i.e. a descendant of the
host View, with the given virtualViewId
or the host View itself
virtualViewId
equals to HOST_VIEW_ID
.virtualViewId
- A client defined virtual view id which defined
the root of the tree in which to perform the search.text
- The searched text.createAccessibilityNodeInfo(int)
,
AccessibilityNodeInfoCompat
@Nullable public AccessibilityNodeInfoCompat findFocus(int focus)
focus
- The focus to find. One of
AccessibilityNodeInfoCompat.FOCUS_INPUT
or
AccessibilityNodeInfoCompat.FOCUS_ACCESSIBILITY
.AccessibilityNodeInfoCompat.FOCUS_INPUT
,
AccessibilityNodeInfoCompat.FOCUS_ACCESSIBILITY