android layout properties details

  • 2020-05-09 19:14:48
  • OfStack

android:id specifies the appropriate ID for the control
android:text specifies the text of the control, using strings.xml whenever possible
android:grivity specifies the basic position of the control, such as weight lifting, to the right,
android:padding specifies the inner margin of the control, the content within the control
android:singleLine, if set to true, displays the content of the control in the same row

android:layout_above places the bottom of the space above the space given by ID
android:layout_below: places the top of the control under the control given ID
android:layout_toLeftOf: align the right edge of the control with the left edge of the control given ID
android:layout_toRightOf aligns the left edge of the control with the right edge of the control for a given ID

android:layout_alignBaseLine the baseline of this control is aligned with the Baseline of the control given ID
android:layout_alignBottom compares the bottom edge of the control to the bottom edge of the given ID control
android:layout_alignLeft aligns the left edge of the control with the left edge of the given ID control
android:layout_alignRight aligns the right edge of the control with the right edge of the given ID control
android:layout_alignTop aligns the top edge of a given control with the top of a given ID control

android:alignParentBottom aligns the bottom of the control with the bottom of the parent control if the value is true
android:layout_alignParentLeft aligns the left side of the control with the left side of the parent control if the value is true
android:layout_alignParentRight aligns the right side of the control with the right side of the parent control if the value is true
android:layout_alignParentTop aligns the top of the control with the top of the parent control

android:layout_centerHorizontal: if the value is true, the control will be placed in the horizontal center
android:layout_centerInParent will be centered both horizontally and vertically for the parent control
android:layout_centerVertical will be placed in the vertical center

Class 1: attribute values are true or false

android:layout_centerHrizontal level is in the middle
android:layout_centerVertical is vertically centered
android:layout_centerInparent is completely centered relative to the parent element
android:layout_alignParentBottom is attached to the bottom edge of the parent element
android:layout_alignParentLeft sticks to the left edge of the parent element
android:layout_alignParentRight sticks to the right edge of the parent element
android:layout_alignParentTop attaches to the top edge of the parent element
android:layout_alignWithParentIfMissing: use the parent element as a reference if the corresponding sibling cannot be found

Class 2: the attribute value must be the id reference name "@id/id-name"

android:layout_below is below an element
android:layout_above is above the element
android:layout_toLeftOf is to the left of an element
android:layout_toRightOf is to the right of an element
android:layout_alignTop the top edge of this element is aligned with the top edge of an element
android:layout_alignLeft: the left edge of this element is aligned with the left edge of an element
android:layout_alignBottom: the bottom edge of this element is aligned with the bottom edge of an element
android:layout_alignRight: the right edge of this element aligns with the right edge of an element

Category 3: attribute values are specific pixel values, such as 30dip, 40px

android: the distance from the bottom edge of the parent control to layout_marginBottom
android: the distance from the left edge of the parent control to layout_marginLeft
android: the distance from the right edge of the parent control to layout_marginRight
android: the distance from the top edge of the parent control to layout_marginTop

EditText android: hint
Enter the prompt message in the box when EditText is set to null.

android: gravity
android: the gravity attribute is a qualification to the view content. For example, text above an button. You can set the text to the left or right of view. Take button for example, android:gravity="right" then button above

The word right

android:layout_gravity
android:layout_gravity is used to set the position of view relative to the parent view. For example, if an button is in linearlayout, you can set the button to the left, right, etc. Take button for example,

android:layout_gravity="right" button is to the right

android:layout_alignParentRight
Causes the right end of the current control to align with the right end of the parent control. Here the property value can only be true or false, the default is false.

Differences between padding and margin:
So padding defines the distance between the content of the control and the edge of the control. padding means padding, while margin means the distance beyond the four edges of the control, meaning the distance between the control and other controls. margin has edges, but the page is left

The meaning of white

//AlphaAnimation controls the gradient transparent animation effect
//ScaleAnimatin controls the size scaling animation
//TranslateAnimation controls the animation effect of panning the screen
//RotateAnimation controls the animation effect of Angle change (rotation)
//LayoutAnimation renders the animation of each View in ViewGroup when displayed

android: scaleType:
android:scaleType controls how images resized/moved come to ImageView size. ImageView.ScaleType/android:
CENTER/center is shown in the center of the original size image. When the length/width of the image exceeds the length/width of View, the image is shown in the center of the image
CENTER_CROP/centerCrop scale up the size centered display of the image so that the length (width) of the image is equal to or greater than the length (width) of View
CENTER_INSIDE/centerInside shows the full contents of the image in the center, making the length/width of the image equal to or less than the length/width of View by scaling down or the original size
FIT_CENTER/fitCenter scale up/down the image to the width of View, centered
FIT_END/fitEnd scale up/down the image to the width of View and display it in the lower part of View
FIT_START/fitStart scale up/down the image to the width of View and display it in the upper part of View
FIT_XY/fitXY displays the image/out of scale/enlarged/shrunk to the size of View
MATRIX/matrix is drawn using a matrix, dynamically zooming in and out of the image to display.

** note 1 that the names of images in the Drawable folder cannot be capitalized.

Related articles: