Here's how to start:
1.LinearLayout:
Linear layout, the most general layout, in the XML file we only need to specify the size of the layout, such as width (width), height (high) equivalent, and orientation (direction), we can put the control in order to fill in, the control will be in accordance with the direction of our specified line, There is no more to say, do not know the friend please refer to the API documentation or other blog related to the network.
2.TableLayout:
Table layout, a very specification of the layout, since it is a table, naturally there will be the ranks of the points, we set up a good <TableLayout> tag, the inside of the <TABLEROW>, adding a sub-tag, in which the control in turn, the control will be displayed in the row, Each time you add a sub-tag <tablerow>, the layout will be more than one row, these uses are relatively basic, the above two I do not do too much to explain.
3.RelativeLayout:
Relative layout, why should I focus on this? Because this layout is very flexible, can be very detailed layout, is the layout of the heavy weight, then how do we understand this relative? I believe that we have learned high school physics, we want to describe the position and movement of the object need to have a reference frame (referential), such as a square, we take it as a referential, then we describe a store location can be said that the mall in the south of the square. Relative layout is the truth, when the control is placed in this mode, you can let people better place the control to their desired position, then we said, since it is relative, then the answer is not unique? Yes, for example, or that square, if there is another residential building on the west side of the square, then we can also say that the mall in the southeast of the residential building, is not easy to understand?
Let's take a look at some of the important attributes that Relativelayout uses:
—————————————————————————————————————-
First Class: Property value is True or False
Android:layout_centerhrizontal Horizontal Center
Android:layout_centervertical Vertical Center
Android:layout_centerinparent is completely centered relative to the parent element
Android:layout_alignparentbottom snaps to the bottom edge of the parent element
Android:layout_alignparentleft snaps to the left edge of the parent element
Android:layout_alignparentright snaps to the right edge of the parent element
Android:layout_alignparenttop snaps to the top edge of the parent element
android:layout_alignwithparentifmissing if the corresponding sibling element is not found,
Parent element to make reference
Second class: The attribute value must be the reference name of the id "@id/id-name"
Android:layout_below at the bottom of an element
Android:layout_above at the top of an element
Android:layout_toleftof on the left side of an element
Android:layout_torightof on the right side of an element
Android:layout_aligntop aligns the top edge of this element with the top edge of an element
Android:layout_alignleft aligns the left edge of this element with the left edge of an element
Android:layout_alignbottom aligns the bottom edge of this element with the bottom edge of an element
Android:layout_alignright aligns the right edge of this element with the right edge of an element
Class III: Attribute values are specific pixel values, such as 30dip,40px
Android:layout_marginbottom distance from the bottom edge of an element
Android:layout_marginleft distance from the left edge of an element from the right edge of an element
Android:layout_marginright
Android:layout_margintop distance from the top edge of an element
EditText's Android:hint
Sets the prompt information in the input box when EditText is empty.
Android:gravity
The Android:gravity property is the qualification for the view content. For example, a button above the text.
You can set the text on the left side of the view, on the right, and so on. With the button as
example, android:gravity= "right" then the text on the button
Android:layout_gravity
Android:layout_gravity is used to set the position of the view relative to the parent view. Like a
button in the LinearLayout, you want to put the button on the left, on the right and so on, you can pass
The property setting. Take button For example, android:layout_gravity= "right" button on
Android:layout_alignparentright
Aligns the right end of the current control with the right end of the parent control. This property value can only be true or FALSE, the default
False
Android:scaletype:
Android:scaletype is a size that controls how the picture resized/moved to the ImageView.
The meaning difference of Imageview.scaletype/android:scaletype value:
Center/center is centered on the original size of the image, when the picture is longer/wider than the length/width of the View,
The center portion of the captured picture is displayed
Center_crop/centercrop equal to or greater than the length (width) of the View to enlarge the size of the picture proportionally
Center display, make the picture long (wide)
Center_inside/centerinside Displays the contents of the picture in a full center, by scaling it down or
The original size makes the picture long/wide equal to or less than the length/width of the View
Fit_center/fitcenter enlarge/Shrink the picture to the width of the View, centered on the display
Fit_end/fitend enlarge/Shrink the image to the width of the view, shown in the lower part of the view
Sub-location
Fit_start/fitstart the image proportionally to the width of the view, displayed in the view's
Upper part position
Fit_xy/fitxy The picture is not scaled up/down to the view size display
The Matrix/matrix is drawn with a matrix and is displayed by zooming in and out of the image.
Android Layout Preliminary