Stay organized with collections
Save and categorize content based on your preferences.
ViewGroup.OnHierarchyChangeListener
public
static
interface
ViewGroup.OnHierarchyChangeListener
android.view.ViewGroup.OnHierarchyChangeListener
|
Known indirect 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
onChildViewAdded
public abstract void onChildViewAdded (View parent,
View child)
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
public abstract void onChildViewRemoved (View parent,
View child)
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](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \n\nViewGroup.OnHierarchyChangeListener\n===================================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/view/ViewGroup.OnHierarchyChangeListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nViewGroup.OnHierarchyChangeListener\n`\n\n\n`\n\n\n`\n\n|--------------------------------------------------|\n| android.view.ViewGroup.OnHierarchyChangeListener |\n\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known indirect subclasses [WebView](/reference/android/webkit/WebView) |----------------------------------------------|---------------------------------| | [WebView](/reference/android/webkit/WebView) | A View that displays web pages. | |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nInterface definition for a callback to be invoked when the hierarchy\nwithin this view changed. The hierarchy changes whenever a child is added\nto or removed from this view.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onChildViewAdded](/reference/android/view/ViewGroup.OnHierarchyChangeListener#onChildViewAdded(android.view.View,%20android.view.View))`(`[View](/reference/android/view/View)` parent, `[View](/reference/android/view/View)` child) ` Called when a new child is added to a parent view. |\n| ` abstract void` | ` `[onChildViewRemoved](/reference/android/view/ViewGroup.OnHierarchyChangeListener#onChildViewRemoved(android.view.View,%20android.view.View))`(`[View](/reference/android/view/View)` parent, `[View](/reference/android/view/View)` child) ` Called when a child is removed from a parent view. |\n\nPublic methods\n--------------\n\n### onChildViewAdded\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onChildViewAdded (View parent, \n View child)\n```\n\nCalled when a new child is added to a parent view.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------|----------------------------------------------------------|\n| `parent` | `View`: the view in which a child was added \u003cbr /\u003e |\n| `child` | `View`: the new child view added in the hierarchy \u003cbr /\u003e |\n\n### onChildViewRemoved\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onChildViewRemoved (View parent, \n View child)\n```\n\nCalled when a child is removed from a parent view.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------|----------------------------------------------------------|\n| `parent` | `View`: the view from which the child was removed \u003cbr /\u003e |\n| `child` | `View`: the child removed from the hierarchy \u003cbr /\u003e |"]]