Relativelayout Relative layout
Relativelayout is a relative layout, where the position of the control is calculated by relative position, where the latter depends on the base position of the previous control, which is the most common and flexible layout of the layout.
Below are some of the commonly used properties
relativelayout Some important attributes to use:
First Class: property value is True or False
Android:layout_ Centerhrizontal Horizontal Center
android:layout_centervertical Center vertically
Android:layout_centerinparent 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 a reference to a parent element if the corresponding sibling element is not found
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 above an element
Android:layout_toleftof on the left side of an element
Android: Layout_torightof to the right of an element
android:layout_aligntop Aligns the top edge of this element with the top edge of an element
Android:layout_alignleft the left edge of this element and the left edge of an element
Android:layout_alignbottom The bottom edge of this element and the bottom edge of an element are aligned
Android:layout_alignright the right edge of this element and the right edge of an element
third class: attribute values are specific pixel values, such as 30dip,40px
Android: Layout_marginbottom the distance from the bottom edge of an element
Android:layout_marginleft the distance from the left edge of an element
Android:layout_marginright the distance from the right edge of an element
Android:layout_margintop the distance from the top edge of an element
EditText android:hint
set EditText to empty when prompted in the box.
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. Take the button as an example, android:gravity= "right" then the text on the button above the
android:layout_gravity The
Android:layout_gravity is used to set the position of the view relative to the parent view. For example, a button in the LinearLayout, you want to put the button on the left, right and other positions can be set by this property. Take the button as an example, android:layout_gravity= "right" then 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, which is false by default.
Android:scaletype : The
Android:scaletype is a size that controls how the picture resized/moved to the ImageView. Meaning difference of Imageview.scaletype/android:scaletype value:
center/center is centered on the original size of the picture, when the picture is long/ width exceeds the length/width of the view, the center portion of the captured picture displays the
center_crop/centercrop proportionally expands the size of the picture to the center of the display, Make the picture long (wide) equal to or greater than the length (width) of the view
center_inside/centerinside Displays the contents of the picture in a full center, Make the picture long/wide equal to or less than the length/width of the view
by proportionally shrinking or the original size
fit_center/fitcenter enlarge/Narrow the picture to the width of the view , centered
fit_end/fitend enlarge/shrink the picture proportionally to the width of the view, displayed in the lower part of the view
fit_start/fitstart enlarge/shrink the picture proportionally to the width of the view, displayed in the upper part of the view
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.
Learning diary for Android------relativelayout relative layout