Android Setcontentview processing process

Source: Internet
Author: User
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

  1. Window is an abstract class that provides a variety of ways to manipulate windows, such as setting a background title, and so on.

  2. 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.
  3. 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

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.