Basic design of UI (User Interface) in Android

Source: Internet
Author: User
Tags resource

The UI (User Interface) consists of four basic elements, view (view), ViewGroup (view group), Fragment (fragment), activity (active);

View: The base class for all visual interface elements;

ViewGroup: Extension of the view class, containing multiple child views, layout manager;

Fragment: Create a reusable layout and divide the layout into chunks;

Acitivity: A window or screen that is displayed to the user, which needs to be assigned a view;

All visual components are derived from the view class;

Assigning a user interface to an activity, using Setcontentview (), can accept the ID (Resource) of a layout resource, or accept an instance of a separate view (new);

Findviewbyid (), a reference to each view in the layout (layout), can find any child views of fragment from the parent activity;

The layout manager is an inheritance of the ViewGroup class, which controls the position of the child control in the UI and contains four common layout classes:

Framelayout: Simple layout manager, direct accumulation, the default upper left corner, will create a cover;

LinearLayout: Layout management in vertical or horizontal direction;

Relativelayout: Each child view and other views, as well as the relative position of the screen;

GridLayout: Grid view, nested various views and layouts;

You can add controls to the view and adjust the parameters;

Wrap_content: The minimum size of the content, wrap (surround);

Match_parent: Fills the parent Class View;

You can also use code to implement layouts;

Author: csdn Blog spike_king

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/

Related Article

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.