Android UI View and ViewGroup

Source: Internet
Author: User

1. Basic Concepts

View: The parent of all visual controls, an object that the user can interact with on the Android app screen (for example, a button drop-down box text box, and so on).

A subclass of Viewgroup:view that holds the layout container for view and ViewGroup objects (linear layout, relative layout, and so on).

Simply understood, view is a variety of controls (buttons, text), and ViewGroup provides a variety of layout modes.

Any component in the app is a hierarchical structure that uses view and ViewGroup objects. For example, ViewGroup is used for the organization layout mode of the View object to which each view represents an input control or UI part.

2. Defining layouts

Method 1: Instantiate the View object in code and build the UI hierarchy tree;

Method 2: Use XML to compose the layout (reading habits, the most common way), the element name in the XML file represents view, so the <TextView> element creates the TextView control, <linearlayout > element to create a linearlayout container;

3. Common layout
    • LinearLayout (Linear layout)
    • Relativelayout (relative layout)
    • Tablelayout (Table layout)
    • Framelayout (Frame layout)
    • Absolutelayout (Absolute layout)
    • GridLayout (Grid layout)
4. Common Controls
    • TextView (text box)
    • EditText (input box)
    • button (buttons) and ImageButton (image button)
    • ImageView (Image view)
    • RadioButton (radio button) &checkbox (check box)
    • Switch button ToggleButton and switching switch
    • ProgressBar (progress bar)
    • SeekBar (drag bar)
    • Ratingbar (star rating bar)
    • ScrollView (scroll bar)
    • Date&time components

Android UI View and ViewGroup

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.