Builder
class Builder
kotlin.Any | |
↳ | android.view.WindowInsets.Builder |
Builder for WindowInsets.
Summary
Public constructors | |
---|---|
Builder() Creates a builder where all insets are initially consumed. |
|
Builder(insets: WindowInsets) Creates a builder where all insets are initialized from |
Public methods | |
---|---|
WindowInsets |
build() Builds a |
WindowInsets.Builder |
setBoundingRects(typeMask: Int, rects: MutableList<Rect!>) Sets the bounding rects. |
WindowInsets.Builder |
setBoundingRectsIgnoringVisibility(typeMask: Int, rects: MutableList<Rect!>) Sets the bounding rects while ignoring their visibility state. |
WindowInsets.Builder |
setDisplayCutout(displayCutout: DisplayCutout?) Sets the display cutout. |
WindowInsets.Builder |
setDisplayShape(displayShape: DisplayShape) Sets the display shape. |
WindowInsets.Builder |
Set the frame size. |
WindowInsets.Builder |
Sets the insets of a specific window type in pixels. |
WindowInsets.Builder |
setInsetsIgnoringVisibility(typeMask: Int, insets: Insets) Sets the insets a specific window type in pixels, while ignoring its visibility state. |
WindowInsets.Builder |
setMandatorySystemGestureInsets(insets: Insets) Sets mandatory system gesture insets in pixels. |
WindowInsets.Builder |
setPrivacyIndicatorBounds(bounds: Rect?) Sets the bounds of the system privacy indicator. |
WindowInsets.Builder |
setRoundedCorner(position: Int, roundedCorner: RoundedCorner?) Sets the rounded corner of given position. |
WindowInsets.Builder |
setStableInsets(stableInsets: Insets) Sets the stable insets in pixels. |
WindowInsets.Builder |
setSystemGestureInsets(insets: Insets) Sets system gesture insets in pixels. |
WindowInsets.Builder |
setSystemWindowInsets(systemWindowInsets: Insets) Sets system window insets in pixels. |
WindowInsets.Builder |
setTappableElementInsets(insets: Insets) Sets tappable element insets in pixels. |
WindowInsets.Builder |
setVisible(typeMask: Int, visible: Boolean) Sets whether windows that can cause insets are currently visible on screen. |
Public constructors
Builder
Builder(insets: WindowInsets)
Creates a builder where all insets are initialized from WindowInsets
.
Parameters | |
---|---|
insets |
WindowInsets: the instance to initialize from. This value cannot be null . |
Public methods
build
fun build(): WindowInsets
Builds a WindowInsets
instance.
Return | |
---|---|
WindowInsets |
the WindowInsets instance. This value cannot be null . |
setBoundingRects
fun setBoundingRects(
typeMask: Int,
rects: MutableList<Rect!>
): WindowInsets.Builder
Sets the bounding rects.
Parameters | |
---|---|
typeMask |
Int: the inset types to which these rects apply. Value is either 0 or a combination of android.view.WindowInsets.Type.STATUS_BARS, android.view.WindowInsets.Type.NAVIGATION_BARS, android.view.WindowInsets.Type.CAPTION_BAR, android.view.WindowInsets.Type.IME, android.view.WindowInsets.Type.WINDOW_DECOR, android.view.WindowInsets.Type.SYSTEM_GESTURES, android.view.WindowInsets.Type.MANDATORY_SYSTEM_GESTURES, android.view.WindowInsets.Type.TAPPABLE_ELEMENT, android.view.WindowInsets.Type.DISPLAY_CUTOUT, and android.view.WindowInsets.Type.SYSTEM_OVERLAYS |
rects |
MutableList<Rect!>: the bounding rects. This value cannot be null . |
Return | |
---|---|
WindowInsets.Builder |
itself. This value cannot be null . |
setBoundingRectsIgnoringVisibility
fun setBoundingRectsIgnoringVisibility(
typeMask: Int,
rects: MutableList<Rect!>
): WindowInsets.Builder
Sets the bounding rects while ignoring their visibility state.
Parameters | |
---|---|
typeMask |
Int: the inset types to which these rects apply. Value is either 0 or a combination of android.view.WindowInsets.Type.STATUS_BARS, android.view.WindowInsets.Type.NAVIGATION_BARS, android.view.WindowInsets.Type.CAPTION_BAR, android.view.WindowInsets.Type.IME, android.view.WindowInsets.Type.WINDOW_DECOR, android.view.WindowInsets.Type.SYSTEM_GESTURES, android.view.WindowInsets.Type.MANDATORY_SYSTEM_GESTURES, android.view.WindowInsets.Type.TAPPABLE_ELEMENT, android.view.WindowInsets.Type.DISPLAY_CUTOUT, and android.view.WindowInsets.Type.SYSTEM_OVERLAYS |
rects |
MutableList<Rect!>: the bounding rects. This value cannot be null . |
Return | |
---|---|
WindowInsets.Builder |
itself. This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
If typeMask contains Type#ime() . Maximum bounding rects are not available for this type as the height of the IME is dynamic depending on the EditorInfo of the currently focused view, as well as the UI state of the IME. |
setDisplayCutout
fun setDisplayCutout(displayCutout: DisplayCutout?): WindowInsets.Builder
Sets the display cutout.
Parameters | |
---|---|
displayCutout |
DisplayCutout?: the display cutout or null if there is none |
Return | |
---|---|
WindowInsets.Builder |
itself This value cannot be null . |
See Also
setDisplayShape
fun setDisplayShape(displayShape: DisplayShape): WindowInsets.Builder
Sets the display shape.
Parameters | |
---|---|
displayShape |
DisplayShape: the display shape. This value cannot be null . |
Return | |
---|---|
WindowInsets.Builder |
itself. This value cannot be null . |
See Also
setFrame
fun setFrame(
width: Int,
height: Int
): WindowInsets.Builder
Set the frame size.
Parameters | |
---|---|
width |
Int: the width of the frame. |
height |
Int: the height of the frame. |
Return | |
---|---|
WindowInsets.Builder |
itself. This value cannot be null . |
setInsets
fun setInsets(
typeMask: Int,
insets: Insets
): WindowInsets.Builder
Sets the insets of a specific window type in pixels.
The insets represents the area of a a window that is partially or fully obscured by the system windows identified by typeMask
.
Parameters | |
---|---|
typeMask |
Int: The bitmask of Type to set the insets for. Value is either 0 or a combination of android.view.WindowInsets.Type.STATUS_BARS, android.view.WindowInsets.Type.NAVIGATION_BARS, android.view.WindowInsets.Type.CAPTION_BAR, android.view.WindowInsets.Type.IME, android.view.WindowInsets.Type.WINDOW_DECOR, android.view.WindowInsets.Type.SYSTEM_GESTURES, android.view.WindowInsets.Type.MANDATORY_SYSTEM_GESTURES, android.view.WindowInsets.Type.TAPPABLE_ELEMENT, android.view.WindowInsets.Type.DISPLAY_CUTOUT, and android.view.WindowInsets.Type.SYSTEM_OVERLAYS |
insets |
Insets: The insets to set. This value cannot be null . |
Return | |
---|---|
WindowInsets.Builder |
itself This value cannot be null . |
See Also
setInsetsIgnoringVisibility
fun setInsetsIgnoringVisibility(
typeMask: Int,
insets: Insets
): WindowInsets.Builder
Sets the insets a specific window type in pixels, while ignoring its visibility state.
The insets represents the area of a a window that that may be partially or fully obscured by the system window identified by type
. This value does not change based on the visibility state of those elements. For example, if the status bar is normally shown, but temporarily hidden, the inset returned here will still provide the inset associated with the status bar being shown.
Parameters | |
---|---|
typeMask |
Int: The bitmask of Type to set the insets for. Value is either 0 or a combination of android.view.WindowInsets.Type.STATUS_BARS, android.view.WindowInsets.Type.NAVIGATION_BARS, android.view.WindowInsets.Type.CAPTION_BAR, android.view.WindowInsets.Type.IME, android.view.WindowInsets.Type.WINDOW_DECOR, android.view.WindowInsets.Type.SYSTEM_GESTURES, android.view.WindowInsets.Type.MANDATORY_SYSTEM_GESTURES, android.view.WindowInsets.Type.TAPPABLE_ELEMENT, android.view.WindowInsets.Type.DISPLAY_CUTOUT, and android.view.WindowInsets.Type.SYSTEM_OVERLAYS |
insets |
Insets: The insets to set. This value cannot be null . |
Return | |
---|---|
WindowInsets.Builder |
itself This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
If typeMask contains Type#ime() . Maximum insets are not available for this type as the height of the IME is dynamic depending on the EditorInfo of the currently focused view, as well as the UI state of the IME. |
See Also
setMandatorySystemGestureInsets
funsetMandatorySystemGestureInsets(insets: Insets): WindowInsets.Builder
Deprecated: Use setInsets(int,android.graphics.Insets)
with Type#mandatorySystemGestures()
.
Sets mandatory system gesture insets in pixels.
The mandatory system gesture insets represent the area of a window where mandatory system gestures have priority and may consume some or all touch input, e.g. due to the a system bar occupying it, or it being reserved for touch-only gestures.
In contrast to regular system gestures
, mandatory system gestures cannot be overriden by View#setSystemGestureExclusionRects
.
Parameters | |
---|---|
insets |
Insets: This value cannot be null . |
Return | |
---|---|
WindowInsets.Builder |
itself This value cannot be null . |
See Also
setPrivacyIndicatorBounds
fun setPrivacyIndicatorBounds(bounds: Rect?): WindowInsets.Builder
Sets the bounds of the system privacy indicator.
Parameters | |
---|---|
bounds |
Rect?: The bounds of the system privacy indicator This value may be null . |
Return | |
---|---|
WindowInsets.Builder |
This value cannot be null . |
setRoundedCorner
fun setRoundedCorner(
position: Int,
roundedCorner: RoundedCorner?
): WindowInsets.Builder
Sets the rounded corner of given position.
Parameters | |
---|---|
position |
Int: the position of this rounded corner Value is android.view.RoundedCorner#POSITION_TOP_LEFT , android.view.RoundedCorner#POSITION_TOP_RIGHT , android.view.RoundedCorner#POSITION_BOTTOM_RIGHT , or android.view.RoundedCorner#POSITION_BOTTOM_LEFT |
roundedCorner |
RoundedCorner?: the rounded corner or null if there is none |
Return | |
---|---|
WindowInsets.Builder |
itself This value cannot be null . |
See Also
setStableInsets
funsetStableInsets(stableInsets: Insets): WindowInsets.Builder
Deprecated: Use setInsetsIgnoringVisibility(int,android.graphics.Insets)
with Type#systemBars()
.
Sets the stable insets in pixels.
The stable inset represents the area of a full-screen window that may be partially or fully obscured by the system UI elements. This value does not change based on the visibility state of those elements; for example, if the status bar is normally shown, but temporarily hidden, the stable inset will still provide the inset associated with the status bar being shown.
Parameters | |
---|---|
stableInsets |
Insets: This value cannot be null . |
Return | |
---|---|
WindowInsets.Builder |
itself This value cannot be null . |
See Also
setSystemGestureInsets
funsetSystemGestureInsets(insets: Insets): WindowInsets.Builder
Deprecated: Use setInsets(int,android.graphics.Insets)
with Type#systemGestures()
.
Sets system gesture insets in pixels.
The system gesture insets represent the area of a window where system gestures have priority and may consume some or all touch input, e.g. due to the a system bar occupying it, or it being reserved for touch-only gestures.
Parameters | |
---|---|
insets |
Insets: This value cannot be null . |
Return | |
---|---|
WindowInsets.Builder |
itself This value cannot be null . |
See Also
setSystemWindowInsets
funsetSystemWindowInsets(systemWindowInsets: Insets): WindowInsets.Builder
Deprecated: Use setInsets(int,android.graphics.Insets)
with Type#systemBars()
.
Sets system window insets in pixels.
The system window inset represents the area of a full-screen window that is partially or fully obscured by the status bar, navigation bar, IME or other system windows.
Parameters | |
---|---|
systemWindowInsets |
Insets: This value cannot be null . |
Return | |
---|---|
WindowInsets.Builder |
itself This value cannot be null . |
See Also
setTappableElementInsets
funsetTappableElementInsets(insets: Insets): WindowInsets.Builder
Deprecated: Use setInsets(int,android.graphics.Insets)
with Type#tappableElement()
.
Sets tappable element insets in pixels.
The tappable element insets represent how much tappable elements must at least be inset to remain both tappable and visually unobstructed by persistent system windows.
Parameters | |
---|---|
insets |
Insets: This value cannot be null . |
Return | |
---|---|
WindowInsets.Builder |
itself This value cannot be null . |
See Also
setVisible
fun setVisible(
typeMask: Int,
visible: Boolean
): WindowInsets.Builder
Sets whether windows that can cause insets are currently visible on screen.
Parameters | |
---|---|
typeMask |
Int: The bitmask of Type to set the visibility for. Value is either 0 or a combination of android.view.WindowInsets.Type.STATUS_BARS, android.view.WindowInsets.Type.NAVIGATION_BARS, android.view.WindowInsets.Type.CAPTION_BAR, android.view.WindowInsets.Type.IME, android.view.WindowInsets.Type.WINDOW_DECOR, android.view.WindowInsets.Type.SYSTEM_GESTURES, android.view.WindowInsets.Type.MANDATORY_SYSTEM_GESTURES, android.view.WindowInsets.Type.TAPPABLE_ELEMENT, android.view.WindowInsets.Type.DISPLAY_CUTOUT, and android.view.WindowInsets.Type.SYSTEM_OVERLAYS |
visible |
Boolean: Whether to mark the windows as visible or not. |
Return | |
---|---|
WindowInsets.Builder |
itself This value cannot be null . |
See Also