Condividi tramite


View.OnFocusChanged(Boolean, FocusSearchDirection, Rect) Method

Definition

Called by the view system when the focus state of this view changes.

[Android.Runtime.Register("onFocusChanged", "(ZILandroid/graphics/Rect;)V", "GetOnFocusChanged_ZILandroid_graphics_Rect_Handler")]
protected virtual void OnFocusChanged (bool gainFocus, Android.Views.FocusSearchDirection direction, Android.Graphics.Rect? previouslyFocusedRect);
[<Android.Runtime.Register("onFocusChanged", "(ZILandroid/graphics/Rect;)V", "GetOnFocusChanged_ZILandroid_graphics_Rect_Handler")>]
abstract member OnFocusChanged : bool * Android.Views.FocusSearchDirection * Android.Graphics.Rect -> unit
override this.OnFocusChanged : bool * Android.Views.FocusSearchDirection * Android.Graphics.Rect -> unit

Parameters

gainFocus
Boolean

True if the View has focus; false otherwise.

direction
FocusSearchDirection

The direction focus has moved when requestFocus() is called to give this view focus. Values are #FOCUS_UP, #FOCUS_DOWN, #FOCUS_LEFT, #FOCUS_RIGHT, #FOCUS_FORWARD, or #FOCUS_BACKWARD. It may not always apply, in which case use the default.

previouslyFocusedRect
Rect

The rectangle, in this view's coordinate system, of the previously focused view. If applicable, this will be passed in as finer grained information about where the focus is coming from (in addition to direction). Will be null otherwise.

Attributes

Remarks

Called by the view system when the focus state of this view changes. When the focus change event is caused by directional navigation, direction and previouslyFocusedRect provide insight into where the focus is coming from. When overriding, be sure to call up through to the super class so that the standard focus handling will occur.

Java documentation for android.view.View.onFocusChanged(boolean, int, android.graphics.Rect).

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