Based on the source code analysis on Android 4.4:
Setcontentview Process:
GetWindow ()->setcontentview (), Installdecor () AddView ()
GetWindow () returned the Phonewindow
Installdecor () generates the window's Rootview Decorview
AddView () will result in Performtraversals () Decorview, Requestlayout (), Getviewrootimpl ()
Performtravsals () The workflow is done recursively:
Draw () measure (), Layout ()
Measure () different ViewGroup type measurement process (framelayout, linearlayout, relativelayout, etc.)
Framelayout as long as the measurement of all sub-view a piece, the speed of measurement is the fastest
LinearLayout is also a single measurement of all sub-view, but it is necessary to re-measure the maximum width or height again when there is a weight attribute
So specifying layout_width= "0DP" or layout_height= "0DP" when writing layout can reduce measurement time
Relativelayout requires a lateral and longitudinal measurement of the pair view. The measurement speed is the slowest, especially when the hierarchy is deep.
Layout () is basically to determine the individual view in the canvas coordinates.
Draw () generates displaylist to generate images for the GPU.
For ViewGroup with multiple sub-view, start with the bottom sub view (index:0) measure, layout, draw.
A brief analysis of Android View