# WindowInsetsCompat

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1  
Summary:[Ctors](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#pubctors)\|[Methods](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#)  

# WindowInsetsCompat

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public


class
WindowInsetsCompat
`  
`

extends Object


``


`

|---|--------------------------------------------|
| java.lang.Object                              ||
| ↳ | android.support.v4.view.WindowInsetsCompat |

<br />

*** ** * ** ***

Describes a set of insets for window content.

WindowInsetsCompats are immutable and may be expanded to include more inset types in the future. To adjust insets, use one of the supplied clone methods to obtain a new WindowInsetsCompat instance with the adjusted properties.

<br />

## Summary

|                                                                                                                                                                                  ### Public constructors                                                                                                                                                                                   ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[WindowInsetsCompat](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#WindowInsetsCompat(android.support.v4.view.WindowInsetsCompat))`(`[WindowInsetsCompat](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat)` src) ` Constructs a new WindowInsetsCompat, copying all values from a source WindowInsetsCompat. |

|                                                                                                                                                                                                                                  ### Public methods                                                                                                                                                                                                                                   ||
|-------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[WindowInsetsCompat](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat) | ` `[consumeStableInsets](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#consumeStableInsets())`() ` Returns a copy of this WindowInsets with the stable insets fully consumed.                                                                                                                                                       |
| ` `[WindowInsetsCompat](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat) | ` `[consumeSystemWindowInsets](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#consumeSystemWindowInsets())`() ` Returns a copy of this WindowInsets with the system window insets fully consumed.                                                                                                                                    |
| ` boolean`                                                                                                  | ` `[equals](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#equals(java.lang.Object))`(Object o) `                                                                                                                                                                                                                                    |
| ` int`                                                                                                      | ` `[getStableInsetBottom](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#getStableInsetBottom())`() ` Returns the bottom stable inset in pixels.                                                                                                                                                                                     |
| ` int`                                                                                                      | ` `[getStableInsetLeft](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#getStableInsetLeft())`() ` Returns the left stable inset in pixels.                                                                                                                                                                                           |
| ` int`                                                                                                      | ` `[getStableInsetRight](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#getStableInsetRight())`() ` Returns the right stable inset in pixels.                                                                                                                                                                                        |
| ` int`                                                                                                      | ` `[getStableInsetTop](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#getStableInsetTop())`() ` Returns the top stable inset in pixels.                                                                                                                                                                                              |
| ` int`                                                                                                      | ` `[getSystemWindowInsetBottom](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#getSystemWindowInsetBottom())`() ` Returns the bottom system window inset in pixels.                                                                                                                                                                  |
| ` int`                                                                                                      | ` `[getSystemWindowInsetLeft](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#getSystemWindowInsetLeft())`() ` Returns the left system window inset in pixels.                                                                                                                                                                        |
| ` int`                                                                                                      | ` `[getSystemWindowInsetRight](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#getSystemWindowInsetRight())`() ` Returns the right system window inset in pixels.                                                                                                                                                                     |
| ` int`                                                                                                      | ` `[getSystemWindowInsetTop](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#getSystemWindowInsetTop())`() ` Returns the top system window inset in pixels.                                                                                                                                                                           |
| ` boolean`                                                                                                  | ` `[hasInsets](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#hasInsets())`() ` Returns true if this WindowInsets has any nonzero insets.                                                                                                                                                                                            |
| ` boolean`                                                                                                  | ` `[hasStableInsets](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#hasStableInsets())`() ` Returns true if this WindowInsets has nonzero stable insets.                                                                                                                                                                             |
| ` boolean`                                                                                                  | ` `[hasSystemWindowInsets](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#hasSystemWindowInsets())`() ` Returns true if this WindowInsets has nonzero system window insets.                                                                                                                                                          |
| ` int`                                                                                                      | ` `[hashCode](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#hashCode())`() `                                                                                                                                                                                                                                                        |
| ` boolean`                                                                                                  | ` `[isConsumed](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#isConsumed())`() ` Check if these insets have been fully consumed.                                                                                                                                                                                                    |
| ` boolean`                                                                                                  | ` `[isRound](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#isRound())`() ` Returns true if the associated window has a round shape.                                                                                                                                                                                                 |
| ` `[WindowInsetsCompat](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat) | ` `[replaceSystemWindowInsets](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#replaceSystemWindowInsets(int, int, int, int))`(int left, int top, int right, int bottom) ` Returns a copy of this WindowInsets with selected system window insets replaced with new values.                                                           |
| ` `[WindowInsetsCompat](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat) | ` `[replaceSystemWindowInsets](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#replaceSystemWindowInsets(android.graphics.Rect))`(`[Rect](https://developer.android.com/reference/android/graphics/Rect.html)` systemWindowInsets) ` Returns a copy of this WindowInsets with selected system window insets replaced with new values. |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Public constructors

### WindowInsetsCompat

added in[version 25.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
WindowInsetsCompat (WindowInsetsCompat src)
```

Constructs a new WindowInsetsCompat, copying all values from a source WindowInsetsCompat.

<br />

|                               Parameters                                ||
|-------|------------------------------------------------------------------|
| `src` | `WindowInsetsCompat`: source from which values are copied <br /> |

## Public methods

### consumeStableInsets

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
WindowInsetsCompat consumeStableInsets ()
```

Returns a copy of this WindowInsets with the stable insets fully consumed.

<br />

|                                                                           Returns                                                                           ||
|----------------------------------------------------------------------------------------------------------|---------------------------------------------------|
| [WindowInsetsCompat](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat) | A modified copy of this WindowInsetsCompat <br /> |

### consumeSystemWindowInsets

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
WindowInsetsCompat consumeSystemWindowInsets ()
```

Returns a copy of this WindowInsets with the system window insets fully consumed.

<br />

|                                                                        Returns                                                                        ||
|----------------------------------------------------------------------------------------------------------|---------------------------------------------|
| [WindowInsetsCompat](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat) | A modified copy of this WindowInsets <br /> |

### equals

```
boolean equals (Object o)
```

<br />

<br />

|      Parameters      ||
|-----|-----------------|
| `o` | `Object` <br /> |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### getStableInsetBottom

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getStableInsetBottom ()
```

Returns the bottom stable inset 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.

<br />

<br />

|                Returns                ||
|-------|--------------------------------|
| `int` | The bottom stable inset <br /> |

### getStableInsetLeft

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getStableInsetLeft ()
```

Returns the left stable inset 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.

<br />

<br />

|               Returns               ||
|-------|------------------------------|
| `int` | The left stable inset <br /> |

### getStableInsetRight

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getStableInsetRight ()
```

Returns the right stable inset 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.

<br />

<br />

|               Returns                ||
|-------|-------------------------------|
| `int` | The right stable inset <br /> |

### getStableInsetTop

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getStableInsetTop ()
```

Returns the top stable inset 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.

<br />

<br />

|              Returns               ||
|-------|-----------------------------|
| `int` | The top stable inset <br /> |

### getSystemWindowInsetBottom

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getSystemWindowInsetBottom ()
```

Returns the bottom system window inset 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.

<br />

<br />

|                   Returns                    ||
|-------|---------------------------------------|
| `int` | The bottom system window inset <br /> |

### getSystemWindowInsetLeft

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getSystemWindowInsetLeft ()
```

Returns the left system window inset 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.

<br />

<br />

|                  Returns                   ||
|-------|-------------------------------------|
| `int` | The left system window inset <br /> |

### getSystemWindowInsetRight

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getSystemWindowInsetRight ()
```

Returns the right system window inset 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.

<br />

<br />

|                   Returns                   ||
|-------|--------------------------------------|
| `int` | The right system window inset <br /> |

### getSystemWindowInsetTop

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getSystemWindowInsetTop ()
```

Returns the top system window inset 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.

<br />

<br />

|                  Returns                  ||
|-------|------------------------------------|
| `int` | The top system window inset <br /> |

### hasInsets

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean hasInsets ()
```

Returns true if this WindowInsets has any nonzero insets.

<br />

|                        Returns                         ||
|-----------|---------------------------------------------|
| `boolean` | true if any inset values are nonzero <br /> |

### hasStableInsets

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean hasStableInsets ()
```

Returns true if this WindowInsets has nonzero stable insets.

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.

<br />

<br />

|                               Returns                                ||
|-----------|-----------------------------------------------------------|
| `boolean` | true if any of the stable inset values are nonzero <br /> |

### hasSystemWindowInsets

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean hasSystemWindowInsets ()
```

Returns true if this WindowInsets has nonzero system window insets.

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.

<br />

<br />

|                                   Returns                                   ||
|-----------|------------------------------------------------------------------|
| `boolean` | true if any of the system window inset values are nonzero <br /> |

### hashCode

```
int hashCode ()
```

<br />

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### isConsumed

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean isConsumed ()
```

Check if these insets have been fully consumed.

Insets are considered "consumed" if the applicable`consume*`methods have been called such that all insets have been set to zero. This affects propagation of insets through the view hierarchy; insets that have not been fully consumed will continue to propagate down to child views.

The result of this method is equivalent to the return value of[fitSystemWindows(android.graphics.Rect)](https://developer.android.com/reference/android/view/View.html#fitSystemWindows(android.graphics.Rect)).

<br />

<br />

|                            Returns                             ||
|-----------|-----------------------------------------------------|
| `boolean` | true if the insets have been fully consumed. <br /> |

### isRound

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean isRound ()
```

Returns true if the associated window has a round shape.

A round window's left, top, right and bottom edges reach all the way to the associated edges of the window but the corners may not be visible. Views responding to round insets should take care to not lay out critical elements within the corners where they may not be accessible.

<br />

<br />

|                    Returns                    ||
|-----------|------------------------------------|
| `boolean` | True if the window is round <br /> |

### replaceSystemWindowInsets

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
WindowInsetsCompat replaceSystemWindowInsets (int left, 
                int top, 
                int right, 
                int bottom)
```

Returns a copy of this WindowInsets with selected system window insets replaced with new values.

<br />

|                     Parameters                     ||
|----------|------------------------------------------|
| `left`   | `int`: New left inset in pixels <br />   |
| `top`    | `int`: New top inset in pixels <br />    |
| `right`  | `int`: New right inset in pixels <br />  |
| `bottom` | `int`: New bottom inset in pixels <br /> |

|                                                                        Returns                                                                        ||
|----------------------------------------------------------------------------------------------------------|---------------------------------------------|
| [WindowInsetsCompat](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat) | A modified copy of this WindowInsets <br /> |

### replaceSystemWindowInsets

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
WindowInsetsCompat replaceSystemWindowInsets (Rect systemWindowInsets)
```

Returns a copy of this WindowInsets with selected system window insets replaced with new values.

<br />

|                                                   Parameters                                                   ||
|----------------------|------------------------------------------------------------------------------------------|
| `systemWindowInsets` | `Rect`: New system window insets. Each field is the inset in pixels for that edge <br /> |

|                                                                        Returns                                                                        ||
|----------------------------------------------------------------------------------------------------------|---------------------------------------------|
| [WindowInsetsCompat](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat) | A modified copy of this WindowInsets <br /> |

-

  ## Annotations

  - [ViewPager.DecorView](https://developer.android.com/reference/android/support/v4/view/ViewPager.DecorView)
-

  ## Interfaces

  - [ActionProvider.VisibilityListener](https://developer.android.com/reference/android/support/v4/view/ActionProvider.VisibilityListener)
  - [AsyncLayoutInflater.OnInflateFinishedListener](https://developer.android.com/reference/android/support/v4/view/AsyncLayoutInflater.OnInflateFinishedListener)
  - [LayoutInflaterFactory](https://developer.android.com/reference/android/support/v4/view/LayoutInflaterFactory)
  - [MenuItemCompat.OnActionExpandListener](https://developer.android.com/reference/android/support/v4/view/MenuItemCompat.OnActionExpandListener)
  - [NestedScrollingChild](https://developer.android.com/reference/android/support/v4/view/NestedScrollingChild)
  - [NestedScrollingChild2](https://developer.android.com/reference/android/support/v4/view/NestedScrollingChild2)
  - [NestedScrollingParent](https://developer.android.com/reference/android/support/v4/view/NestedScrollingParent)
  - [NestedScrollingParent2](https://developer.android.com/reference/android/support/v4/view/NestedScrollingParent2)
  - [OnApplyWindowInsetsListener](https://developer.android.com/reference/android/support/v4/view/OnApplyWindowInsetsListener)
  - [ScrollingView](https://developer.android.com/reference/android/support/v4/view/ScrollingView)
  - [TintableBackgroundView](https://developer.android.com/reference/android/support/v4/view/TintableBackgroundView)
  - [ViewPager.OnAdapterChangeListener](https://developer.android.com/reference/android/support/v4/view/ViewPager.OnAdapterChangeListener)
  - [ViewPager.OnPageChangeListener](https://developer.android.com/reference/android/support/v4/view/ViewPager.OnPageChangeListener)
  - [ViewPager.PageTransformer](https://developer.android.com/reference/android/support/v4/view/ViewPager.PageTransformer)
  - [ViewPropertyAnimatorListener](https://developer.android.com/reference/android/support/v4/view/ViewPropertyAnimatorListener)
  - [ViewPropertyAnimatorUpdateListener](https://developer.android.com/reference/android/support/v4/view/ViewPropertyAnimatorUpdateListener)
-

  ## Classes

  - [AbsSavedState](https://developer.android.com/reference/android/support/v4/view/AbsSavedState)
  - [AccessibilityDelegateCompat](https://developer.android.com/reference/android/support/v4/view/AccessibilityDelegateCompat)
  - [ActionProvider](https://developer.android.com/reference/android/support/v4/view/ActionProvider)
  - [AsyncLayoutInflater](https://developer.android.com/reference/android/support/v4/view/AsyncLayoutInflater)
  - [GestureDetectorCompat](https://developer.android.com/reference/android/support/v4/view/GestureDetectorCompat)
  - [GravityCompat](https://developer.android.com/reference/android/support/v4/view/GravityCompat)
  - [InputDeviceCompat](https://developer.android.com/reference/android/support/v4/view/InputDeviceCompat)
  - [LayoutInflaterCompat](https://developer.android.com/reference/android/support/v4/view/LayoutInflaterCompat)
  - [MarginLayoutParamsCompat](https://developer.android.com/reference/android/support/v4/view/MarginLayoutParamsCompat)
  - [MenuCompat](https://developer.android.com/reference/android/support/v4/view/MenuCompat)
  - [MenuItemCompat](https://developer.android.com/reference/android/support/v4/view/MenuItemCompat)
  - [MotionEventCompat](https://developer.android.com/reference/android/support/v4/view/MotionEventCompat)
  - [NestedScrollingChildHelper](https://developer.android.com/reference/android/support/v4/view/NestedScrollingChildHelper)
  - [NestedScrollingParentHelper](https://developer.android.com/reference/android/support/v4/view/NestedScrollingParentHelper)
  - [PagerAdapter](https://developer.android.com/reference/android/support/v4/view/PagerAdapter)
  - [PagerTabStrip](https://developer.android.com/reference/android/support/v4/view/PagerTabStrip)
  - [PagerTitleStrip](https://developer.android.com/reference/android/support/v4/view/PagerTitleStrip)
  - [PointerIconCompat](https://developer.android.com/reference/android/support/v4/view/PointerIconCompat)
  - [ScaleGestureDetectorCompat](https://developer.android.com/reference/android/support/v4/view/ScaleGestureDetectorCompat)
  - [VelocityTrackerCompat](https://developer.android.com/reference/android/support/v4/view/VelocityTrackerCompat)
  - [ViewCompat](https://developer.android.com/reference/android/support/v4/view/ViewCompat)
  - [ViewConfigurationCompat](https://developer.android.com/reference/android/support/v4/view/ViewConfigurationCompat)
  - [ViewGroupCompat](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat)
  - [ViewPager](https://developer.android.com/reference/android/support/v4/view/ViewPager)
  - [ViewPager.LayoutParams](https://developer.android.com/reference/android/support/v4/view/ViewPager.LayoutParams)
  - [ViewPager.SavedState](https://developer.android.com/reference/android/support/v4/view/ViewPager.SavedState)
  - [ViewPager.SimpleOnPageChangeListener](https://developer.android.com/reference/android/support/v4/view/ViewPager.SimpleOnPageChangeListener)
  - [ViewParentCompat](https://developer.android.com/reference/android/support/v4/view/ViewParentCompat)
  - [ViewPropertyAnimatorCompat](https://developer.android.com/reference/android/support/v4/view/ViewPropertyAnimatorCompat)
  - [ViewPropertyAnimatorListenerAdapter](https://developer.android.com/reference/android/support/v4/view/ViewPropertyAnimatorListenerAdapter)
  - [WindowCompat](https://developer.android.com/reference/android/support/v4/view/WindowCompat)
  - [WindowInsetsCompat](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat)