According to the doc, the first is
Interface definition for a callback to be invoked when the layout bounds of a view changes due to layout processing.
and the second is
Interface definition for a callback to be invoked when the global layout state or the visibility of views within the view tree changes.
///
But they seem pretty similar to me. I was even able to use both of them interchangeably. Can someone give me a practical example of the usage of them? Thanks
An OnLayoutChangeListener
is a listener for a specific View
and will trigger only when that View
goes through a layout pass (i.e. onLayout()
is called).
An OnGlobalLayoutListener
watches the entire hierarchy for layout changes (so registering one of these on any View
in a hierarchy will cause it to be triggered when any View
in that hierarchy is laid out or changes visibility).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With