hierarchyListener

Runs onHierarchyChange when the component's place in the hierarchy changes - it is handed to a parent, loses one, or starts or stops being on screen. The event's change flags say which.

onHierarchyChange is read when the event fires, so writing a fresh lambda on every recomposition registers nothing again.

Return

this chain with the hierarchy callback declared on it.

Parameters

onHierarchyChange

receives the event; its changeFlags hold the HierarchyEvent.*_CHANGED bits, and changed is the component the change happened to - this component itself or one of its ancestors.

See also


Attaches a HierarchyListener (addHierarchyListener/removeHierarchyListener).

Return

this chain with the hierarchy listener declared on it.

Parameters

listener

attached by identity, so a remembered instance stays put while a fresh one on every pass is detached and re-added.

See also