Implementation principle of layout files during Activity creation, activity Layout
SetContenView (R. id. activity) implementation principle
1. The underlying framework finds the layout File Based on the layout ID.
2. the underlying framework parses this layout file (pull parsing ).
3. The underlying framework constructs the element objects (EditText, TextView, etc.) in the layout file through reflection ).
4. The underlying framework places the Element Object (view) in the Activity.
5. Activityk invisible. The blank area of the xml view is a layout file (such as linear layout and relative layout ). Activity is not a View, and Activity is a subclass of Context.
Which class is findViewById?
1. A method must have a class or Class Object to call. The class call method is a static method. When no class or Class Object is called for a method, the method uses this by default, so findViewById belongs to Activity.