Stay organized with collections
Save and categorize content based on your preferences.
OnWindowVisibilityChangeListener
interface OnWindowVisibilityChangeListener
Interface definition for a callback to be invoked when the view hierarchy's window visibility changes.
Summary
Public methods |
abstract Unit |
Callback method to be invoked when the window visibility changes in the view tree.
|
Public methods
onWindowVisibilityChanged
abstract fun onWindowVisibilityChanged(visibility: Int): Unit
Callback method to be invoked when the window visibility changes in the view tree.
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.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# ViewTreeObserver.OnWindowVisibilityChangeListener\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOnWindowVisibilityChangeListener\n================================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/view/ViewTreeObserver.OnWindowVisibilityChangeListener \"View this page in Java\") \n\n```\ninterface OnWindowVisibilityChangeListener\n```\n\n|---------------------------------------------------------------------|\n| [android.view.ViewTreeObserver.OnWindowVisibilityChangeListener](#) |\n\nInterface definition for a callback to be invoked when the view hierarchy's window visibility changes.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onWindowVisibilityChanged](#onWindowVisibilityChanged(kotlin.Int))`(`visibility:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Callback method to be invoked when the window visibility changes in the view tree. |\n\nPublic methods\n--------------\n\n### onWindowVisibilityChanged\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onWindowVisibilityChanged(visibility: Int): Unit\n```\n\nCallback method to be invoked when the window visibility changes in the view tree.\n\n| Parameters ||\n|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `visibility` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The new visibility of the window. Value is [android.view.View#VISIBLE](/reference/kotlin/android/view/View#VISIBLE:kotlin.Int), [android.view.View#INVISIBLE](/reference/kotlin/android/view/View#INVISIBLE:kotlin.Int), or [android.view.View#GONE](/reference/kotlin/android/view/View#GONE:kotlin.Int) |"]]