共用方式為


View.HasFocusable Property

Definition

Returns true if this view is focusable or if it contains a reachable View for which #hasFocusable() returns true.

public virtual bool HasFocusable { [Android.Runtime.Register("hasFocusable", "()Z", "GetHasFocusableHandler")] get; }
[<get: Android.Runtime.Register("hasFocusable", "()Z", "GetHasFocusableHandler")>]
member this.HasFocusable : bool

Property Value

true if the view is focusable or if the view contains a focusable view, false otherwise

Attributes

Remarks

Returns true if this view is focusable or if it contains a reachable View for which #hasFocusable() returns true. A "reachable hasFocusable()" is a view whose parents do not block descendants focus. Only #VISIBLE views are considered focusable.

As of Build.VERSION_CODES#O views that are determined to be focusable through #FOCUSABLE_AUTO will also cause this method to return true. Apps that declare a android.content.pm.ApplicationInfo#targetSdkVersion of earlier than Build.VERSION_CODES#O will continue to see this method return false for views not explicitly marked as focusable. Use #hasExplicitFocusable() if you require the pre-Build.VERSION_CODES#O behavior.

Java documentation for android.view.View.hasFocusable().

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