Udostępnij za pośrednictwem


IWindowManager.CurrentWindowMetrics Property

Definition

Returns the WindowMetrics according to the current system state.

public virtual Android.Views.WindowMetrics CurrentWindowMetrics { [Android.Runtime.Register("getCurrentWindowMetrics", "()Landroid/view/WindowMetrics;", "GetGetCurrentWindowMetricsHandler:Android.Views.IWindowManager, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=30)] get; }
[<get: Android.Runtime.Register("getCurrentWindowMetrics", "()Landroid/view/WindowMetrics;", "GetGetCurrentWindowMetricsHandler:Android.Views.IWindowManager, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=30)>]
member this.CurrentWindowMetrics : Android.Views.WindowMetrics

Property Value

Attributes

Remarks

Returns the WindowMetrics according to the current system state.

The metrics describe the size of the area the window would occupy with LayoutParams#MATCH_PARENT MATCH_PARENT width and height, and the WindowInsets such a window would have.

The value of this is based on the <b>current</b> windowing state of the system.

For example, for activities in multi-window mode, the metrics returned are based on the current bounds that the user has selected for the android.app.Activity Activity's task.

In most scenarios, #getCurrentWindowMetrics() rather than #getMaximumWindowMetrics() is the correct API to use, since it ensures values reflect window size when the app is not fullscreen.

Java documentation for android.view.WindowManager.getCurrentWindowMetrics().

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