Foundation (2, Activty\windows\view relationship)

Source: Internet
Author: User

A little understanding of the individual:

1, the activity corresponds to an application interface, but itself more belongs to the control;

2, view is the basis of all UI elements, the subclass of view becomes "Widget", all ViewGroup subclasses become "Layout";

3 window refers to a rectangular display area, usually there are two, one is the entire phone screen, the other is the type of dialog box;

4. Activity Associates a window, which invokes the Makenewwindow method when it is created, and returns a Phonewindow object (the only implementation of the window abstract class);

4.1, in Phonewindow will first create a decorview (the top layer is a linearlayout), the view draws the basic interface of the phone, such as the status bar, the interface is drawn first, relying on the definition of manifest theme;

4.2. When the activity calls Setcontentview, it is actually drawn by window in the content area of the Decorview (a framelayout under the top linearlayout); When we add UI elements to a custom layout, Essentially, the Framlayout object is AddView (); The real setcontentview should be this:

GetWindow (). Setcontentview (Layoutinflater.from (this). Inflate (R.layout.main, null));

Where Layoutinflater is a class used to instantiate an XML layout file as a View object

4.3, window will create the view root object and Windowmanagerservice, understand is to register their activity Phonewindow to the System window management, so that can be recalled to different system events, such as button lights

Foundation (2, Activty\windows\view relationship)

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.