Implementation principle of layout files during Activity creation, activity Layout

Source: Internet
Author: User

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.

Related Article

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.