Trace the source code of the activity and you will find:
Activity. attch ()-> policymanager-> Policy-> phonewindow-> mlayoutinflater. Inflate () & mcontentparent. addview ()
This is just a simple tracing process description. TrackingSource codeYou can clearly see the relationship between them.
Activity is like a craftsman (control unit), window is like a window (bearing model), view is like a window (display view)
Layoutinflater is like scissors and xml configuration is like a window drawing.
1) A window is initialized when an activity is constructed, which is phonewindow.
2) This phonewindow has a "viewroot". The quotation marks indicate that this "viewroot" is a view or viewgroup, which is the initial Root View.
3) "viewroot" adds views one by one using addview. Such as textview and button
4) event listening for these views is implemented by windowmanagerservice to receive messages and callback the activity function. For example, onclicklistener and onkeydown.
Is activity a display view of Android?
No
What does layoutinflater do? What does layoutinflater. Inflater () do?
Generally, we use layoutinflater to do one thing: inflate. The inflate method has four forms in total to convert layout expressed in XML into view.
This class is used to instantiate layout XML file into its corresponding view objects. It is never be used directly -- Use
Getlayoutinflater () or getsystemservice (string) to retrieve a standard
Layoutinflater instance that is already hooked up to the current context and correctly configured for the device you are
Running on