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/