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

# View.OnApplyWindowInsetsListener

*** ** * ** ***

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


`
public
static


interface
View.OnApplyWindowInsetsListener
`


`


`

|---|
| android.view.View.OnApplyWindowInsetsListener |

<br />

*** ** * ** ***

Listener for applying window insets on a view in a custom way.

Apps may choose to implement this interface if they want to apply custom policy
to the way that window insets are treated for a view. If an OnApplyWindowInsetsListener
is set, its
`https://developer.android.com/reference/android/view/View.OnApplyWindowInsetsListener#onApplyWindowInsets(android.view.View,%20android.view.WindowInsets)`
method will be called instead of the View's own
`https://developer.android.com/reference/android/view/View#onApplyWindowInsets(android.view.WindowInsets)` method. The listener
may optionally call the parameter View's `onApplyWindowInsets` method to apply
the View's normal behavior as part of its own.

<br />

## Summary

| ### Public methods ||
|---|---|
| ` abstract https://developer.android.com/reference/android/view/WindowInsets` | ` https://developer.android.com/reference/android/view/View.OnApplyWindowInsetsListener#onApplyWindowInsets(android.view.View,%20android.view.WindowInsets)(https://developer.android.com/reference/android/view/View v, https://developer.android.com/reference/android/view/WindowInsets insets) ` When `https://developer.android.com/reference/android/view/View#setOnApplyWindowInsetsListener(android.view.View.OnApplyWindowInsetsListener)` on a View, this listener method will be called instead of the view's own `https://developer.android.com/reference/android/view/View#onApplyWindowInsets(android.view.WindowInsets)` method. |

## Public methods

### onApplyWindowInsets

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

```
public abstract WindowInsets onApplyWindowInsets (View v, 
                WindowInsets insets)
```

When `https://developer.android.com/reference/android/view/View#setOnApplyWindowInsetsListener(android.view.View.OnApplyWindowInsetsListener)`
on a View, this listener method will be called instead of the view's own
`https://developer.android.com/reference/android/view/View#onApplyWindowInsets(android.view.WindowInsets)` method.

<br />

| Parameters ||
|---|---|
| `v` | `View`: The view applying window insets. This value cannot be `null`. <br /> |
| `insets` | `WindowInsets`: The insets to apply. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/WindowInsets` | The insets supplied, minus any insets that were consumed. This value cannot be `null`. <br /> |