UI Chapter (II)

Source: Internet
Author: User

First, the attribute
1.android:layout_width:
1.fill_parent:match_parent and fill_parent have the same meaning.
2.match_parent: Indicates that the size of the current control is the same as the size of the parent layout, which is the parent layout that determines the size of the current control.
3.wrap_content: Indicates that the size of the current control can contain exactly what is inside it, that is, the contents of the control determine the size of the current control

2.android:visibility Visibility Properties
Visible: Viewable
Invisible: not visible
Gone: not only invisible, but also no longer occupies any screen space
3.android:gravity used to specify how text is aligned in the control
4.android:layout_gravity used to specify how the control is aligned in the layout
5.android:layout_weight Layout Weights

Relative Layout properties:
1. The attribute group (1) that is positioned relative to the control:
The 1.android:layout_above property allows a control to be located above another control
2.android:layout_below means that a control is placed below another control
3.android:layout_toleftof means to have one control on the left side of another control
4.android:layout_torightof means to have one control on the right side of another control
2. Align the attribute group relative to the parent layout:
1. Android:layout_alignparentleft
2.android:layout_alignparenttop
3.android:layout_alignparentright
4.android:layout_alignparentbottom
5.android:layout_centerinparent
3. The attribute group (2) that is positioned relative to the control:
1.android:layout_alignleft means to align the left edge of one control with the left edge of another control
2.android:layout_alignright means to align the right edge of one control with the right edge of another control
3.android:layout_aligntop means to align the top edge of one control with the top edge of another control
4. Android:layout_alignbottom means to align the bottom edge of one control with the bottom edge of another control

Second, the component

1.TextView
Text controls

2.Button
Button controls

3.EditText
Text input Box control

4.ImageView
A control for displaying pictures on the interface

5.ProgressBar
Used to display a progress bar on the interface, indicating that our program is loading some data

6.AlertDialog
To pop up a dialog box at the current interface, which is pinned to all interface elements
That can mask the interactivity of other controls, so general Alertdialog are used to prompt some very important
Content or warning messages.

7.ProgressDialog
ProgressDialog and Alertdialog are a bit similar, they can pop up a dialog box on the interface, all of them can block
The ability to interact with other controls. The difference is that ProgressDialog will display a progress bar in the dialog box, which is generally
Used to indicate that the current operation is time consuming and allows the user to wait patiently.

Third, the layout
1.LinearLayout
LinearLayout, also known as linear layout, is a very common layout. As its name describes, this
Layout will arrange the controls that it contains in a linear direction.
2.RelativeLayout
Relativelayout, also known as relative layout, is a very common layout. LinearLayout and the arrangement of the rules
is different, relativelayout is more casual, it can be relatively positioned to make the control appear in the layout
of any location.

3.FrameLayout
This layout is not positioned in any way, and all controls are placed in the upper left corner of the layout

4.TableLayout
Allowing us to arrange the controls in a tabular way, which is not very common, you just need to know the basic usage of it.

5.AbsoluteLayout
This layout is officially deprecated.

6. Custom Layouts
1. The first way: Write an XML layout file that is inserted into other layouts via the <include layout= "" > Plug-in mode.
2. The second approach: Dynamically load layout files, add things to elements in a file, and so on, by inheriting related classes (for example: LinearLayout),
Finally, the layout dynamic class is introduced through other layout XML files to complete the layout insertion.

7.ListView: Main 2 components
1. Main layout: Refers to the layout with the ListView component placed
2. Entry layout: Refers to the layout of each entry
Note: When overriding the GetView method, the view parameter in the method is repeatedly passed in at the bottom, and when it is used, it is created at the first time, which reduces the duplicate creation of the view object each time the method is called.

Units and Dimensions
1.DP: is a density-independent pixel meaning, also known as dip, and PX, it in different densities of the display ratio will be consistent
2.SP: It is the meaning of the scalable pixel, it adopts the same design concept as DP, solves the problem of the adaptation of the text size.

UI Chapter (II)

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.