Share via


View.OnWindowFocusChanged(Boolean) Method

Definition

Called when the window containing this view gains or loses focus.

[Android.Runtime.Register("onWindowFocusChanged", "(Z)V", "GetOnWindowFocusChanged_ZHandler")]
public virtual void OnWindowFocusChanged (bool hasWindowFocus);
[<Android.Runtime.Register("onWindowFocusChanged", "(Z)V", "GetOnWindowFocusChanged_ZHandler")>]
abstract member OnWindowFocusChanged : bool -> unit
override this.OnWindowFocusChanged : bool -> unit

Parameters

hasWindowFocus
Boolean

True if the window containing this view now has focus, false otherwise.

Attributes

Remarks

Called when the window containing this view gains or loses focus. Note that this is separate from view focus: to receive key events, both your view and its window must have focus. If a window is displayed on top of yours that takes input focus, then your own window will lose focus but the view focus will remain unchanged.

Java documentation for android.view.View.onWindowFocusChanged(boolean).

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