The relationship between activity Window View ViewGroup in Android

Source: Internet
Author: User

Activity: One of the four main Android components for displaying an interface to interact with the user

---- Display Interface

---- interacting with users

Activity is equivalent to the controller, which is responsible for invoking the business class method. simple business can be handled directly in the activity .

Activity is built into the setcontentview ( Resource location ) of the Window object . Resource Type . Resources ) method to show the interface.

User through the View operator interface.

When interacting with the user, the event is captured through the View , and the message is passed through windowmanagerservice ( the control of the current operation, the type of the event ). the Android Framework then backs up the corresponding Activity method to enable interaction with the user.

window: Yes android view decorview (decorative view), which is the top-level of the main window view ( decorview must be a layout container because it will accommodate the other view ). When activity call setcontentview ()

The Setcontentview () method of the Window object , which executes the method to add a user-defined View to the Decorview The final completion of the View the display.

View: A basic building block of a user interface component that occupies a rectangular area on the screen , which is the base class for the UI control, such as a button or text box. View is responsible for graphical interface rendering and event handling

Android has provided us with a range of standard UI controls for direct use, and we can also inherit from the view or view subclass, to implement our own custom UI Control

ViewGroup: View Group in Android. Contains more than one View, or it can contain viewgroup.

ViewGroup is a special view that can accommodate other view ( child controls ), which is the base class for layout and view containers

* Viewgroup.layoutparams Layout parameter class properties:

Android:layout_width Width relative to the parent control (wrap_content, match_parent,fill_parent)

Android:layout_height relative to the parent control height (wrap_content,match_parent,fill_parent)

* Common methods of ViewGroup

AddView (): Adding a view to a group of views

Removeview (): Remove view from the Views group

Getchildcount: Get the number of view group child controls

Getchildat (): get a specific child control

viewgroup is a subclass of View in Android , and the layout manager is ViewGroup sub-class.

The relationship between activity Window View ViewGroup in Android

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.