Share via


AccessibilityNodeInfo.FindFocus(NodeFocus) Method

Definition

Find the view that has the specified focus type.

[Android.Runtime.Register("findFocus", "(I)Landroid/view/accessibility/AccessibilityNodeInfo;", "GetFindFocus_IHandler")]
public virtual Android.Views.Accessibility.AccessibilityNodeInfo? FindFocus (Android.Views.Accessibility.NodeFocus focus);
[<Android.Runtime.Register("findFocus", "(I)Landroid/view/accessibility/AccessibilityNodeInfo;", "GetFindFocus_IHandler")>]
abstract member FindFocus : Android.Views.Accessibility.NodeFocus -> Android.Views.Accessibility.AccessibilityNodeInfo
override this.FindFocus : Android.Views.Accessibility.NodeFocus -> Android.Views.Accessibility.AccessibilityNodeInfo

Parameters

focus
NodeFocus

The focus to find. One of #FOCUS_INPUT or #FOCUS_ACCESSIBILITY.

Returns

The node info of the focused view or null.

Attributes

Remarks

Find the view that has the specified focus type. The search starts from the view represented by this node info.

<strong>Note:</strong> If this view hierarchy has a SurfaceView embedding another view hierarchy via SurfaceView#setChildSurfacePackage, there is a limitation that this API won't be able to find the node for the view on the embedded view hierarchy. It's because views don't know about the embedded hierarchies. Instead, you could traverse all the children to find the node. Or, use AccessibilityService#findFocus(int) for #FOCUS_ACCESSIBILITY only since it has no such limitation.

Java documentation for android.view.accessibility.AccessibilityNodeInfo.findFocus(int).

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.

Applies to

See also