Android Guides | Samples

Android.Views.ViewTreeObserver Class

A view tree observer is used to register listeners that can be notified of global changes in the view tree.

See Also: ViewTreeObserver

Syntax

[Android.Runtime.Register("android/view/ViewTreeObserver", DoNotGenerateAcw=true)]
public sealed class ViewTreeObserver : Object

Remarks

A view tree observer is used to register listeners that can be notified of global changes in the view tree. Such global events include, but are not limited to, layout of the whole tree, beginning of the drawing pass, touch mode change.... A ViewTreeObserver should never be instantiated by applications as it is provided by the views hierarchy. Refer to View.ViewTreeObserver for more information.

[Android Documentation]

Requirements

Namespace: Android.Views
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Views.ViewTreeObserver are listed below.

See Also: Object

Public Properties

[read-only]
IsAliveBoolean. Indicates whether this ViewTreeObserver is alive.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

AddOnDrawListener(ViewTreeObserver+IOnDrawListener)
AddOnGlobalFocusChangeListener(ViewTreeObserver+IOnGlobalFocusChangeListener)
Register a callback to be invoked when the focus state within the view tree changes.
AddOnGlobalLayoutListener(ViewTreeObserver+IOnGlobalLayoutListener)
Register a callback to be invoked when the global layout state or the visibility of views within the view tree changes
AddOnPreDrawListener(ViewTreeObserver+IOnPreDrawListener)
Register a callback to be invoked when the view tree is about to be drawn
AddOnScrollChangedListener(ViewTreeObserver+IOnScrollChangedListener)
Register a callback to be invoked when a view has been scrolled.
AddOnTouchModeChangeListener(ViewTreeObserver+IOnTouchModeChangeListener)
Register a callback to be invoked when the invoked when the touch mode changes.
AddOnWindowAttachListener(ViewTreeObserver+IOnWindowAttachListener)
Register a callback to be invoked when the view hierarchy is attached to a window.
AddOnWindowFocusChangeListener(ViewTreeObserver+IOnWindowFocusChangeListener)
Register a callback to be invoked when the window focus state within the view tree changes.
DispatchOnDraw()
Notifies registered listeners that the drawing pass is about to start.
DispatchOnGlobalLayout()
Notifies registered listeners that a global layout happened.
DispatchOnPreDraw() : Boolean
Notifies registered listeners that the drawing pass is about to start.
RemoveGlobalOnLayoutListener(ViewTreeObserver+IOnGlobalLayoutListener)
Remove a previously installed global layout callback
RemoveOnDrawListener(ViewTreeObserver+IOnDrawListener)
RemoveOnGlobalFocusChangeListener(ViewTreeObserver+IOnGlobalFocusChangeListener)
Remove a previously installed focus change callback.
RemoveOnGlobalLayoutListener(ViewTreeObserver+IOnGlobalLayoutListener)
Remove a previously installed global layout callback
RemoveOnPreDrawListener(ViewTreeObserver+IOnPreDrawListener)
Remove a previously installed pre-draw callback
RemoveOnScrollChangedListener(ViewTreeObserver+IOnScrollChangedListener)
Remove a previously installed scroll-changed callback
RemoveOnTouchModeChangeListener(ViewTreeObserver+IOnTouchModeChangeListener)
Remove a previously installed touch mode change callback
RemoveOnWindowAttachListener(ViewTreeObserver+IOnWindowAttachListener)
Remove a previously installed window attach callback.
RemoveOnWindowFocusChangeListener(ViewTreeObserver+IOnWindowFocusChangeListener)
Remove a previously installed window focus change callback.

Public Events