# WindowInsets.Builder

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/view/WindowInsets.Builder "View this page in Java")  

```
class Builder
```

|---|------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                         ||
| ↳ | [android.view.WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) |

Builder for WindowInsets.

## Summary

|                                                                                                                                                                                    Public constructors                                                                                                                                                                                     ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#Builder())`()` Creates a builder where all insets are initially consumed.                                                                                                                                                                                                                    |
| [Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#Builder(android.view.WindowInsets))`(`insets:` `[WindowInsets](https://developer.android.com/reference/kotlin/android/view/WindowInsets)`)` Creates a builder where all insets are initialized from[WindowInsets](https://developer.android.com/reference/kotlin/android/view/WindowInsets). |

|                                                                                                                                                                                                                                                                                                                                     Public methods                                                                                                                                                                                                                                                                                                                                     ||
|-----------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [WindowInsets](https://developer.android.com/reference/kotlin/android/view/WindowInsets)                  | [build](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#build())`()` Builds a[WindowInsets](https://developer.android.com/reference/kotlin/android/view/WindowInsets)instance.                                                                                                                                                                                                                                                                                                                                                             |
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | [setBoundingRects](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setBoundingRects(kotlin.Int,%20kotlin.collections.MutableList))`(`typeMask:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `rects:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)!>`)` Sets the bounding rects.                                                                           |
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | [setBoundingRectsIgnoringVisibility](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setBoundingRectsIgnoringVisibility(kotlin.Int,%20kotlin.collections.MutableList))`(`typeMask:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `rects:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)!>`)` Sets the bounding rects while ignoring their visibility state. |
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | [setDisplayCutout](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setDisplayCutout(android.view.DisplayCutout))`(`displayCutout:` `[DisplayCutout](https://developer.android.com/reference/kotlin/android/view/DisplayCutout)?`)` Sets the display cutout.                                                                                                                                                                                                                                                                                |
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | [setDisplayShape](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setDisplayShape(android.view.DisplayShape))`(`displayShape:` `[DisplayShape](https://developer.android.com/reference/kotlin/android/view/DisplayShape)`)` Sets the display shape.                                                                                                                                                                                                                                                                                        |
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | [setFrame](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setFrame(kotlin.Int,%20kotlin.Int))`(`width:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `height:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Set the frame size.                                                                                                                                                                                                                                        |
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | [setInsets](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setInsets(kotlin.Int,%20android.graphics.Insets))`(`typeMask:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `insets:` `[Insets](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#)`)` Sets the insets of a specific window type in pixels.                                                                                                                                                                         |
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | [setInsetsIgnoringVisibility](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setInsetsIgnoringVisibility(kotlin.Int,%20android.graphics.Insets))`(`typeMask:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `insets:` `[Insets](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#)`)` Sets the insets a specific window type in pixels, while ignoring its visibility state.                                                                                                   |
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | [setMandatorySystemGestureInsets](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setMandatorySystemGestureInsets(android.graphics.Insets))`(`insets:` `[Insets](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#)`)` Sets mandatory system gesture insets in pixels.                                                                                                                                                                                                                                          |
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | [setPrivacyIndicatorBounds](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setPrivacyIndicatorBounds(android.graphics.Rect))`(`bounds:` `[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)?`)` Sets the bounds of the system privacy indicator.                                                                                                                                                                                                                                                          |
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | [setRoundedCorner](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setRoundedCorner(kotlin.Int,%20android.view.RoundedCorner))`(`position:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `roundedCorner:` `[RoundedCorner](https://developer.android.com/reference/kotlin/android/view/RoundedCorner)?`)` Sets the rounded corner of given position.                                                                                                                                                      |
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | [setStableInsets](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setStableInsets(android.graphics.Insets))`(`stableInsets:` `[Insets](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#)`)` Sets the stable insets in pixels.                                                                                                                                                                                                                                                                                  |
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | [setSystemGestureInsets](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setSystemGestureInsets(android.graphics.Insets))`(`insets:` `[Insets](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#)`)` Sets system gesture insets in pixels.                                                                                                                                                                                                                                                                      |
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | [setSystemWindowInsets](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setSystemWindowInsets(android.graphics.Insets))`(`systemWindowInsets:` `[Insets](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#)`)` Sets system window insets in pixels.                                                                                                                                                                                                                                                             |
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | [setTappableElementInsets](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setTappableElementInsets(android.graphics.Insets))`(`insets:` `[Insets](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#)`)` Sets tappable element insets in pixels.                                                                                                                                                                                                                                                                |
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | [setVisible](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setVisible(kotlin.Int,%20kotlin.Boolean))`(`typeMask:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `visible:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets whether windows that can cause insets are currently visible on screen.                                                                                                                                                            |

## Public constructors

### Builder

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Builder()
```

Creates a builder where all insets are initially consumed.  

### Builder

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Builder(insets: WindowInsets)
```

Creates a builder where all insets are initialized from[WindowInsets](https://developer.android.com/reference/kotlin/android/view/WindowInsets).

|                                                                           Parameters                                                                            ||
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
| `insets` | [WindowInsets](https://developer.android.com/reference/kotlin/android/view/WindowInsets):the instance to initialize from. This value cannot be`null`. |

## Public methods

### build

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun build(): WindowInsets
```

Builds a[WindowInsets](https://developer.android.com/reference/kotlin/android/view/WindowInsets)instance.

|                                                                                                           Return                                                                                                           ||
|------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|
| [WindowInsets](https://developer.android.com/reference/kotlin/android/view/WindowInsets) | the[WindowInsets](https://developer.android.com/reference/kotlin/android/view/WindowInsets)instance. This value cannot be`null`. |

### setBoundingRects

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setBoundingRects(
    typeMask: Int, 
    rects: MutableList<Rect!>
): WindowInsets.Builder
```

Sets the bounding rects.

|                                                                                                                                                                                                                                                                                                    Parameters                                                                                                                                                                                                                                                                                                     ||
|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `typeMask` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):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.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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)!\>:the bounding rects. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                        |

|                                                                     Return                                                                     ||
|-----------------------------------------------------------------------------------------------------------|-------------------------------------|
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | itself. This value cannot be`null`. |

### setBoundingRectsIgnoringVisibility

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setBoundingRectsIgnoringVisibility(
    typeMask: Int, 
    rects: MutableList<Rect!>
): WindowInsets.Builder
```

Sets the bounding rects while ignoring their visibility state.

|                                                                                                                                                                                                                                                                                                    Parameters                                                                                                                                                                                                                                                                                                     ||
|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `typeMask` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):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.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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)!\>:the bounding rects. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                        |

|                                                                     Return                                                                     ||
|-----------------------------------------------------------------------------------------------------------|-------------------------------------|
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | itself. This value cannot be`null`. |

|                                                                                                                                                                                                                 Exceptions                                                                                                                                                                                                                 ||
|--------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | If`typeMask`contains[Type.ime()](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Type#ime()). Maximum bounding rects are not available for this type as the height of the IME is dynamic depending on the[EditorInfo](https://developer.android.com/reference/kotlin/android/view/inputmethod/EditorInfo)of the currently focused view, as well as the UI state of the IME. |

### setDisplayCutout

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setDisplayCutout(displayCutout: DisplayCutout?): WindowInsets.Builder
```

Sets the display cutout.

|                                                                        Parameters                                                                        ||
|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------|
| `displayCutout` | [DisplayCutout](https://developer.android.com/reference/kotlin/android/view/DisplayCutout)?:the display cutout or null if there is none |

|                                                                    Return                                                                     ||
|-----------------------------------------------------------------------------------------------------------|------------------------------------|
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | itself This value cannot be`null`. |

**See Also**

- [#getDisplayCutout()](https://developer.android.com/reference/kotlin/android/view/WindowInsets#getDisplayCutout())  

### setDisplayShape

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setDisplayShape(displayShape: DisplayShape): WindowInsets.Builder
```

Sets the display shape.

|                                                                       Parameters                                                                        ||
|----------------|-----------------------------------------------------------------------------------------------------------------------------------------|
| `displayShape` | [DisplayShape](https://developer.android.com/reference/kotlin/android/view/DisplayShape):the display shape. This value cannot be`null`. |

|                                                                     Return                                                                     ||
|-----------------------------------------------------------------------------------------------------------|-------------------------------------|
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | itself. This value cannot be`null`. |

**See Also**

- [#getDisplayShape()](https://developer.android.com/reference/kotlin/android/view/WindowInsets#getDisplayShape())  

### setFrame

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setFrame(
    width: Int, 
    height: Int
): WindowInsets.Builder
```

Set the frame size.

|                                                  Parameters                                                   ||
|----------|-----------------------------------------------------------------------------------------------------|
| `width`  | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the width of the frame.  |
| `height` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the height of the frame. |

|                                                                     Return                                                                     ||
|-----------------------------------------------------------------------------------------------------------|-------------------------------------|
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | itself. This value cannot be`null`. |

### setInsets

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The bitmask of[Type](https://developer.android.com/reference/kotlin/android/view/WindowInsets.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.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](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#):The insets to set. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

|                                                                    Return                                                                     ||
|-----------------------------------------------------------------------------------------------------------|------------------------------------|
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | itself This value cannot be`null`. |

**See Also**

- [#getInsets(int)](https://developer.android.com/reference/kotlin/android/view/WindowInsets#getInsets(kotlin.Int))  

### setInsetsIgnoringVisibility

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The bitmask of[Type](https://developer.android.com/reference/kotlin/android/view/WindowInsets.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.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](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#):The insets to set. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

|                                                                    Return                                                                     ||
|-----------------------------------------------------------------------------------------------------------|------------------------------------|
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | itself This value cannot be`null`. |

|                                                                                                                                                                                                             Exceptions                                                                                                                                                                                                             ||
|--------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | If`typeMask`contains[Type.ime()](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Type#ime()). Maximum insets are not available for this type as the height of the IME is dynamic depending on the[EditorInfo](https://developer.android.com/reference/kotlin/android/view/inputmethod/EditorInfo)of the currently focused view, as well as the UI state of the IME. |

**See Also**

- [#getInsetsIgnoringVisibility(int)](https://developer.android.com/reference/kotlin/android/view/WindowInsets#getInsetsIgnoringVisibility(kotlin.Int))  

### setMandatorySystemGestureInsets

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setMandatorySystemGestureInsets(insets: Insets): WindowInsets.Builder
```

**Deprecated:** *Use[setInsets(int,android.graphics.Insets)](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setInsets(kotlin.Int,%20android.graphics.Insets))with[Type.mandatorySystemGestures()](https://developer.android.com/reference/kotlin/android/view/WindowInsets.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](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setSystemGestureInsets(android.graphics.Insets)),**mandatory** system gestures cannot be overridden by[View.setSystemGestureExclusionRects](https://developer.android.com/reference/kotlin/android/view/View#setSystemGestureExclusionRects(kotlin.collections.MutableList)).

|                                                          Parameters                                                          ||
|----------|--------------------------------------------------------------------------------------------------------------------|
| `insets` | [Insets](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#):This value cannot be`null`. |

|                                                                    Return                                                                     ||
|-----------------------------------------------------------------------------------------------------------|------------------------------------|
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | itself This value cannot be`null`. |

**See Also**

- [#getMandatorySystemGestureInsets()](https://developer.android.com/reference/kotlin/android/view/WindowInsets#getMandatorySystemGestureInsets())  

### setPrivacyIndicatorBounds

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setPrivacyIndicatorBounds(bounds: Rect?): WindowInsets.Builder
```

Sets the bounds of the system privacy indicator.

|                                                                            Parameters                                                                             ||
|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
| `bounds` | [Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)?:The bounds of the system privacy indicator This value may be`null`. |

|                                                                 Return                                                                 ||
|-----------------------------------------------------------------------------------------------------------|-----------------------------|
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | This value cannot be`null`. |

### setRoundedCorner

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setRoundedCorner(
    position: Int, 
    roundedCorner: RoundedCorner?
): WindowInsets.Builder
```

Sets the rounded corner of given position.

|                                                                                                                                                                                                                                                                                                                                                                                       Parameters                                                                                                                                                                                                                                                                                                                                                                                       ||
|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `position`      | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the position of this rounded corner Value is[android.view.RoundedCorner#POSITION_TOP_LEFT](https://developer.android.com/reference/kotlin/android/view/RoundedCorner#POSITION_TOP_LEFT:kotlin.Int),[android.view.RoundedCorner#POSITION_TOP_RIGHT](https://developer.android.com/reference/kotlin/android/view/RoundedCorner#POSITION_TOP_RIGHT:kotlin.Int),[android.view.RoundedCorner#POSITION_BOTTOM_RIGHT](https://developer.android.com/reference/kotlin/android/view/RoundedCorner#POSITION_BOTTOM_RIGHT:kotlin.Int), or[android.view.RoundedCorner#POSITION_BOTTOM_LEFT](https://developer.android.com/reference/kotlin/android/view/RoundedCorner#POSITION_BOTTOM_LEFT:kotlin.Int) |
| `roundedCorner` | [RoundedCorner](https://developer.android.com/reference/kotlin/android/view/RoundedCorner)?:the rounded corner or null if there is none                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

|                                                                    Return                                                                     ||
|-----------------------------------------------------------------------------------------------------------|------------------------------------|
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | itself This value cannot be`null`. |

**See Also**

- [#getRoundedCorner(int)](https://developer.android.com/reference/kotlin/android/view/WindowInsets#getRoundedCorner(kotlin.Int))  

### setStableInsets

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setStableInsets(stableInsets: Insets): WindowInsets.Builder
```

**Deprecated:** *Use[setInsetsIgnoringVisibility(int,android.graphics.Insets)](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setInsetsIgnoringVisibility(kotlin.Int,%20android.graphics.Insets))with[Type.systemBars()](https://developer.android.com/reference/kotlin/android/view/WindowInsets.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](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#):This value cannot be`null`. |

|                                                                    Return                                                                     ||
|-----------------------------------------------------------------------------------------------------------|------------------------------------|
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | itself This value cannot be`null`. |

**See Also**

- [#getStableInsets()](https://developer.android.com/reference/kotlin/android/view/WindowInsets#getStableInsets())  

### setSystemGestureInsets

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setSystemGestureInsets(insets: Insets): WindowInsets.Builder
```

**Deprecated:** *Use[setInsets(int,android.graphics.Insets)](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setInsets(kotlin.Int,%20android.graphics.Insets))with[Type.systemGestures()](https://developer.android.com/reference/kotlin/android/view/WindowInsets.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](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#):This value cannot be`null`. |

|                                                                    Return                                                                     ||
|-----------------------------------------------------------------------------------------------------------|------------------------------------|
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | itself This value cannot be`null`. |

**See Also**

- [#getSystemGestureInsets()](https://developer.android.com/reference/kotlin/android/view/WindowInsets#getSystemGestureInsets())  

### setSystemWindowInsets

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setSystemWindowInsets(systemWindowInsets: Insets): WindowInsets.Builder
```

**Deprecated:** *Use[setInsets(int,android.graphics.Insets)](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setInsets(kotlin.Int,%20android.graphics.Insets))with[Type.systemBars()](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Type#systemBars())or[Type.displayCutout()](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Type#displayCutout()).*

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](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#):This value cannot be`null`. |

|                                                                    Return                                                                     ||
|-----------------------------------------------------------------------------------------------------------|------------------------------------|
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | itself This value cannot be`null`. |

**See Also**

- [#getSystemWindowInsets()](https://developer.android.com/reference/kotlin/android/view/WindowInsets#getSystemWindowInsets())  

### setTappableElementInsets

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setTappableElementInsets(insets: Insets): WindowInsets.Builder
```

**Deprecated:** *Use[setInsets(int,android.graphics.Insets)](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#setInsets(kotlin.Int,%20android.graphics.Insets))with[Type.tappableElement()](https://developer.android.com/reference/kotlin/android/view/WindowInsets.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](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#):This value cannot be`null`. |

|                                                                    Return                                                                     ||
|-----------------------------------------------------------------------------------------------------------|------------------------------------|
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | itself This value cannot be`null`. |

**See Also**

- [#getTappableElementInsets()](https://developer.android.com/reference/kotlin/android/view/WindowInsets#getTappableElementInsets())  

### setVisible

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setVisible(
    typeMask: Int, 
    visible: Boolean
): WindowInsets.Builder
```

Sets whether windows that can cause insets are currently visible on screen.

|                                                                                                                                                                                                                                                                                                                                             Parameters                                                                                                                                                                                                                                                                                                                                              ||
|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `typeMask` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The bitmask of[Type](https://developer.android.com/reference/kotlin/android/view/WindowInsets.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.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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):Whether to mark the windows as visible or not.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

|                                                                    Return                                                                     ||
|-----------------------------------------------------------------------------------------------------------|------------------------------------|
| [WindowInsets.Builder](https://developer.android.com/reference/kotlin/android/view/WindowInsets.Builder#) | itself This value cannot be`null`. |

**See Also**

- [#isVisible(int)](https://developer.android.com/reference/kotlin/android/view/WindowInsets#isVisible(kotlin.Int))