Stay organized with collections
Save and categorize content based on your preferences.
View.OnApplyWindowInsetsListener
public
static
interface
View.OnApplyWindowInsetsListener
android.view.View.OnApplyWindowInsetsListener
|
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
onApplyWindowInsets
method will be called instead of the View's own
onApplyWindowInsets
method. The listener
may optionally call the parameter View's onApplyWindowInsets
method to apply
the View's normal behavior as part of its own.
Summary
Public methods
onApplyWindowInsets
public abstract WindowInsets onApplyWindowInsets (View v,
WindowInsets insets)
When set
on a View, this listener method will be called instead of the view's own
onApplyWindowInsets
method.
Parameters |
v |
View : The view applying window insets
This value cannot be null . |
insets |
WindowInsets : The insets to apply
This value cannot be null . |
Returns |
WindowInsets |
The insets supplied, minus any insets that were consumed
This value cannot be null . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# View.OnApplyWindowInsetsListener\n\nAdded in [API level 20](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nView.OnApplyWindowInsetsListener\n================================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/view/View.OnApplyWindowInsetsListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nView.OnApplyWindowInsetsListener\n`\n\n\n`\n\n\n`\n\n|-----------------------------------------------|\n| android.view.View.OnApplyWindowInsetsListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nListener for applying window insets on a view in a custom way.\n\nApps may choose to implement this interface if they want to apply custom policy\nto the way that window insets are treated for a view. If an OnApplyWindowInsetsListener\nis set, its\n[onApplyWindowInsets](/reference/android/view/View.OnApplyWindowInsetsListener#onApplyWindowInsets(android.view.View,%20android.view.WindowInsets))\nmethod will be called instead of the View's own\n[onApplyWindowInsets](/reference/android/view/View#onApplyWindowInsets(android.view.WindowInsets)) method. The listener\nmay optionally call the parameter View's `onApplyWindowInsets` method to apply\nthe View's normal behavior as part of its own.\n\n\u003cbr /\u003e\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract `[WindowInsets](/reference/android/view/WindowInsets) | ` `[onApplyWindowInsets](/reference/android/view/View.OnApplyWindowInsetsListener#onApplyWindowInsets(android.view.View,%20android.view.WindowInsets))`(`[View](/reference/android/view/View)` v, `[WindowInsets](/reference/android/view/WindowInsets)` insets) ` When [set](/reference/android/view/View#setOnApplyWindowInsetsListener(android.view.View.OnApplyWindowInsetsListener)) on a View, this listener method will be called instead of the view's own [onApplyWindowInsets](/reference/android/view/View#onApplyWindowInsets(android.view.WindowInsets)) method. |\n\nPublic methods\n--------------\n\n### onApplyWindowInsets\n\nAdded in [API level 20](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract WindowInsets onApplyWindowInsets (View v, \n WindowInsets insets)\n```\n\nWhen [set](/reference/android/view/View#setOnApplyWindowInsetsListener(android.view.View.OnApplyWindowInsetsListener))\non a View, this listener method will be called instead of the view's own\n[onApplyWindowInsets](/reference/android/view/View#onApplyWindowInsets(android.view.WindowInsets)) method.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------|\n| `v` | `View`: The view applying window insets This value cannot be `null`. \u003cbr /\u003e |\n| `insets` | `WindowInsets`: The insets to apply This value cannot be `null`. \u003cbr /\u003e |\n\n| Returns ||\n|------------------------------------------------------|----------------------------------------------------------------------------------------------|\n| [WindowInsets](/reference/android/view/WindowInsets) | The insets supplied, minus any insets that were consumed This value cannot be `null`. \u003cbr /\u003e |"]]