Udostępnij za pośrednictwem


Configuration.ScreenHeightDp Property

Definition

The height of the available screen space in dp units excluding the area occupied by android.view.WindowInsets window insets, such as the status bar, navigation bar, and cutouts.

[Android.Runtime.Register("screenHeightDp")]
public int ScreenHeightDp { get; set; }
[<Android.Runtime.Register("screenHeightDp")>]
member this.ScreenHeightDp : int with get, set

Property Value

Attributes

Remarks

The height of the available screen space in dp units excluding the area occupied by android.view.WindowInsets window insets, such as the status bar, navigation bar, and cutouts.

"note"><b>Note:</b> The height measurement excludes window insets even when the app is displayed edge to edge using <c>android.view.Window#setDecorFitsSystemWindows(boolean) Window#setDecorFitsSystemWindows(boolean)</c>.</aside>

Corresponds to the available height resource qualifier. Defaults to #SCREEN_HEIGHT_DP_UNDEFINED if no height is specified.

In multi-window mode, equals the height of the available display area of the app window, not the available display area of the device screen (for example, when apps are displayed one above another in split-screen mode in portrait orientation).

For embedded activities, equals the height of the individual activities, not the height of the app window or the device screen.

In multiple-screen scenarios, the height measurement can span screens. For example, if the app is spanning both screens of a dual-screen device rotated 90 degrees (one screen above the other), screenHeightDp represents the height of both screens excluding the area occupied by window insets. When the app is restricted to a single screen in a multiple-screen environment, screenHeightDp is the height of the screen on which the app is displayed excluding window insets.

Differs from android.view.WindowMetrics by not including window insets in the height measurement and by expressing the measurement in dp rather than px. Use screenHeightDp to obtain the height of the display area available to an app or embedded activity excluding the area occupied by window insets. Use android.view.WindowMetrics#getBounds() to obtain the vertical display area available to an app or embedded activity including the area occupied by window insets.

Java documentation for android.content.res.Configuration.screenHeightDp.

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