Stay organized with collections
Save and categorize content based on your preferences.
OnHierarchyChangeListener
interface OnHierarchyChangeListener
Known Direct Subclasses
WebView |
A View that displays web pages.
|
|
Interface definition for a callback to be invoked when the hierarchy within this view changed. The hierarchy changes whenever a child is added to or removed from this view.
Summary
Public methods |
abstract Unit |
Called when a new child is added to a parent view.
|
abstract Unit |
Called when a child is removed from a parent view.
|
Public methods
onChildViewAdded
abstract fun onChildViewAdded(
parent: View!,
child: View!
): Unit
Called when a new child is added to a parent view.
Parameters |
parent |
View!: the view in which a child was added |
child |
View!: the new child view added in the hierarchy |
onChildViewRemoved
abstract fun onChildViewRemoved(
parent: View!,
child: View!
): Unit
Called when a child is removed from a parent view.
Parameters |
parent |
View!: the view from which the child was removed |
child |
View!: the child removed from the hierarchy |
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,["# ViewGroup.OnHierarchyChangeListener\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOnHierarchyChangeListener\n=========================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/view/ViewGroup.OnHierarchyChangeListener \"View this page in Java\") \n\n```\ninterface OnHierarchyChangeListener\n```\n\n|-------------------------------------------------------|\n| [android.view.ViewGroup.OnHierarchyChangeListener](#) |\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [WebView](../webkit/WebView.html#) |------------------------------------|---------------------------------| | [WebView](../webkit/WebView.html#) | A View that displays web pages. | |\n\nInterface definition for a callback to be invoked when the hierarchy within this view changed. The hierarchy changes whenever a child is added to or removed from this view.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onChildViewAdded](#onChildViewAdded(android.view.View,%20android.view.View))`(`parent:` `[View](/reference/kotlin/android/view/View)!`, `child:` `[View](/reference/kotlin/android/view/View)!`)` Called when a new child is added to a parent view. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onChildViewRemoved](#onChildViewRemoved(android.view.View,%20android.view.View))`(`parent:` `[View](/reference/kotlin/android/view/View)!`, `child:` `[View](/reference/kotlin/android/view/View)!`)` Called when a child is removed from a parent view. |\n\nPublic methods\n--------------\n\n### onChildViewAdded\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onChildViewAdded(\n parent: View!, \n child: View!\n): Unit\n```\n\nCalled when a new child is added to a parent view.\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------------------|\n| `parent` | [View](/reference/kotlin/android/view/View)!: the view in which a child was added |\n| `child` | [View](/reference/kotlin/android/view/View)!: the new child view added in the hierarchy |\n\n### onChildViewRemoved\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onChildViewRemoved(\n parent: View!, \n child: View!\n): Unit\n```\n\nCalled when a child is removed from a parent view.\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------------------|\n| `parent` | [View](/reference/kotlin/android/view/View)!: the view from which the child was removed |\n| `child` | [View](/reference/kotlin/android/view/View)!: the child removed from the hierarchy |"]]