(1) View: The most basic UI component that represents a rectangular area on the screen.
(2) window: It is not necessarily the size of a screen, it can be large or small;
It contains the layout parameters of a view tree and a window.
The root view of view tree can be obtained by Getdecorview. You can also set the content View of the window.
(3) The activity:activity contains a window that is called in the activity's attach method by invoking the
Policymanager.makenewwindo Create
(4) WindowManager: A interface, inherited from Viewmanager. There is a implementation
(5) Class:android.view.WindowManagerImpl
In fact, WindowManager is not the window manager of the whole system, but the window manager of the application process. The System Global window Manager runs in the Systemserver process and is a service.
Viewroot interacts with the Global window manager through the Iwindowsession interface. When you add a view to WindowManager, Windowmanagerimpl creates a viewroot to manage the root view of the window. and pass the view to Viewroot through the Viewroot.setview method.
The viewroot is used to manage the root view of the window and interact with the global window manger. Viewroot has a nested class:w,w is a binder subclass that is used to receive various messages from the Global window manager, such as keystroke messages, touch messages, and so on. Viewroot has a member of the W type Mwindow,viewroot creates a W instance in constructor and assigns a value to Mwindow. Viewroot is a subclass of handler, and W passes the message to Viewroot through Looper. Viewroot the Mwindow to Swindowsession in the Setview method.
Call Wm.addview (Decor, L) in Activitythread.java; add it to Window Manager
Proxy in the mviews, creating a viewroot,viewroot for this decor view is responsible for coordinating decor view with window
Manager direct drawing, event processing.
In Viewroot, Iwindowsession and Iwindow were used to deal with Window Manger and receive window
The message from the manager is sent to decor view and then distributed by Decor View. Viewroot.
In summary, each window corresponds to a Windows object, a root view, and a Viewroot object. To create a window, you can call the
WindowManager's AddView method, the view as a parameter will be the root view displayed on the window .
Generally speaking, activity is a visual human-computer interface.
Each activity has a default window, in general, the window is full-screen, of course, there are exceptions, such as the dialog window is not full-screen. The activity can also take advantage of a window other than the default window, such as a pop-up dialog dialog box. 6 i8 J ' I ' B + v. f% r
What is visible in window is a layer of view. The view in window is set in by Setcontentview this interface, and this contentview is the view at the very root of the window.For the screen display, the whole activity is actually a window, so why say it?
In the Activityattach function. There is such a sentence Mwindow = Policymanager.makenewwindow (this);
This is a link to activiyt window. The real connection is Phonewindow.
What is shown in this window is view (activity is a logical thing, adding life cycle management and so on.) The specific things inside are also view. And the implementation of the activation activity is also to the window to add view, to the window to add view, is by calling WindowManager (Windowmanagerimpl). AddView () to achieve.
Why do you say that?
See public void Setcontentview (int layoutresid) {
GetWindow (). Setcontentview (LAYOUTRESID);
}
In AddView, a viewroot is created for each view (this is a logical thing to do with the event handling and logical processing of the view, and to connect with Windowsmanagerservice), and in Windowmanagerimpl, An array of viewroot will be maintained.
The Viewroot.setview () will eventually be called, and the view will be displayed in the Setview. In the implementation of Setview, Session.add () will be called to AddWindow, which will link viewroot and Windowmanagerservice (for example, distributing events), and this method will adjust Use PHONEWINDOWMANAGER.PREPAREADDWINDOWLW ().
It's just a vague concept, and the details need to be hammered out, and I'll keep trying. If you feel like this, you have to give me the top, I also not easy. It's all very hard.
Android View, window,activity concept distinction (2)