Introduction to viewtreeobserver

Source: Internet
Author: User

/** Register a callback function. This callback function is called when the focus status in a view tree changes.

* Callback function to be added with the listener Parameter

* Exception illegalstateexception if isalive () returns false

*/

Public void addonglobalfocuschangelistener (viewtreeobserver. onglobalfocuschangelistener listener)

 

/** Registers a callback function. This callback function is called when the global layout of a view tree changes or the visual status of a view in the view tree changes.

* Callback function to be added with the listener Parameter

* Exception illegalstateexception if isalive () returns false

*/

Public void addongloballayoutlistener (viewtreeobserver. ongloballayoutlistener listener)

 

/** Register a callback function, which is called when a view tree is to be drawn.

* Callback function to be added with the listener Parameter

* Exception illegalstateexception if isalive () returns false

*/

Public void addonpredrawlistener (viewtreeobserver. onpredrawlistener listener)

 

/** Register a callback function, which is called when a view is rolled.

* Callback function to be added with the listener Parameter

* Exception illegalstateexception if isalive () returns false

*/

Public void addonscrollchangedlistener (viewtreeobserver. onscrollchangedlistener listener)

 

/** Register a callback function, which is called when the touch mode changes.

* Callback function to be added with the listener Parameter

* Exception illegalstateexception if isalive () returns false

*/

Public void addontouchmodechangelistener (viewtreeobserver. ontouchmodechangelistener listener)

 

// Notify the corresponding registration listener when the entire layout changes. If you force the view layout or a view that is not attached to a window or in the gone status, it can be manually called

Public final void dispatchongloballayout ()

/** Notify the corresponding registration listener when a view tree is to be drawn. If the listener returns true, the painting will be canceled and rescheduled. If you force a view layout or a view hierarchy that is not attached to a window, or in a gone state, it can be manually called

* If the current painting can be canceled and rescheduled, true is returned; otherwise, false is returned.

*/

Public final Boolean dispatchonpredraw ()

 

/** Indicates whether the current viewtreeobserver is available (alive ). When the observer is unavailable, any method call (except this method) will throw an exception. If an application maintains a long reference with viewtreeobserver, it always needs to detect the return value of this method before calling other methods.

* Return value. If this object is available, true is returned. Otherwise, false is returned.

*/

Public Boolean isalive ()

/** Remove the previously registered global layout callback function.

* Callback function with the victim parameter to be removed

* Exception illegalstateexception if isalive () returns false

*/

Public void removeglobalonlayoutlistener (viewtreeobserver. ongloballayoutlistener victim)

/** Remove the previously registered focus change callback function.

* Callback function with the victim parameter to be removed

* Exception illegalstateexception if isalive () returns false

*/

Public void removeonglobalfocuschangelistener (viewtreeobserver. onglobalfocuschangelistener victim)

/** Remove the previously registered pre-drawn callback function.

* Callback function with the victim parameter to be removed

* Exception illegalstateexception if isalive () returns false

*/

Public void removeonpredrawlistener (viewtreeobserver. onpredrawlistener victim)

/** Remove the previously registered rolling change callback function.

* Callback function with the victim parameter to be removed

* Exception illegalstateexception if isalive () returns false

*/

Public void removeonscrollchangedlistener (viewtreeobserver. onscrollchangedlistener victim)

/** Remove the previously registered touch mode change callback function

* Callback function with the victim parameter to be removed

* Exception illegalstateexception if isalive () returns false

*/

Public void removeontouchmodechangelistener (viewtreeobserver. ontouchmodechangelistener victim)


overview of viewtreeobserver

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.