Android-View Process

Source: Internet
Author: User

There are three types of Log,view displayed in custom view, visible, invisible, and gone, looking at log:

Gone
2  Parametersonfinishinflateonvisibilitychangedonvisibilitychangedonrtlpropertieschangedonrtlpropertieschangedonattachedtowi Ndowonwindowvisibilitychangedonwindowfocuschanged
Invisible
2,  height:1557 144, height:1500  --and l:0  ;  r:144; t:57; b:20 1  : Changed:true  height:1557 144  ; height:1500-- > l:0;  r:144;  t:57  ; b:201  : Changed:falseonwindowfocuschanged
Visible
Construct 2,  height:1557 144  , height:1500  --l:0; r:144; t:57
   ; b:201  : Changed:true  , height:1557144  ; height:1500-- > l:0;  r:144;  t:57  ; b:201  : Changed:falseondrawonwindowfocuschanged

1, see the view by default is visible, is not the default value when the first call onvisibilitychanged, but at this time the view of any location information is not known.

2. A constructor with two parameters is called after visibility changes

3. Inflate complete from XML file

4. Add View to Window (view is gone, then the view creation life cycle ends)

5. Measuring the length and width of the view (onmeasure)

6. Position view in Parent view (onlayout)---> (view is invisible, end of view creation life cycle)

7. OnDraw (only visible view is drawn in window)

Setcontentview (New View (This))
Construct 1,  height:1557--and l:0  ; r:1080  ; t:0  ; b:1557  : Changed: 
   
    true
      ; height:1557
    ---l:0  ; r:1080  ; t:0; b:1557  : Changed :
    false
    ondrawonwindowfocuschanged
   

By default, the length and width of the view is the same as the length and width of the parent view.

Destroyed
Onwindowfocuschanged
Onwindowvisibilitychanged
Ondetachedfromwindow
Summary

The key life cycle for View is

Structure View--onfinishinflate--Onattachedtowindow---Onmeasure, onsizechanged--onlayout W--Ondetackedfromwindow

I'm the dividing line of the king of the Land Tiger.

Android-View Process

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.