1. The activity calls the attach () method before the OnCreate () method, and the Window object is created in the Attach method. The Window object was created without creating a decor object.
2. The user calls the Setcontentview () method in activity.
3, Setcontentview () call the Setcontentview () method of window. The Decorview is checked for presence, and if not present, the Installdecor () method is called to create the Decorview object, and the Generatelayout () method is then called to add the user's own view to the Decorview The last callback callback's Oncontentchanged () method informs the user that the interface has changed.
Precautions
-
Window is an abstract class that provides a variety of ways to manipulate windows, such as setting a background title, and so on.
- Phonewindow is the only implementation class for window, which implements various ways to add a background theme Contentview, internally by Decorview to add a top-level view.
- Each activity has a window, which can be obtained through GetWindow (), and Decorview inherits from Framelayout,setcontentview () is added to the @id/content inside it.
4.setContentView () Creates a decorview, adds the corresponding layout file according to the Theme/feature, and when the Setcontentview () setting is displayed, the oncontentchanged of the activity is recalled ( Method
Android Setcontentview processing process