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