Android layout attributes

Source: Internet
Author: User

For Android, layout-related layout attributes are described as follows:

Class 1: the property value is true or false.
Android: layout_centerhrizontal horizontal center
Android: layout_centervertical vertical center
Android: layout_centerinparent is completely centered over the parent Element
Android: layout_alignparentbottom: attach the lower edge of the parent Element
Android: layout_alignparentleft: Stick the left edge of the parent Element
Android: layout_alignparentright: attaches the right edge of the parent element.
Android: layout_alignparenttop: top the parent Element
Android: layout_alignwithparentifmissing
Class 2: the property value must be the reference name "@ ID/ID-name" of the ID"
Android: layout_below is under an element
Android: layout_abve is above an element.
Android: layout_toleftof on the left of an element
Android: layout_torightof on the right of an element
Android: layout_aligntop: Align the top edge of an element with the top edge of an element.
Android: layout_alignleft: Align the left edge of an element with the left edge of an element.
Android: layout_alignbottom: the bottom edge of the current element is aligned with the bottom edge of an element.
Android: layout_alignright: the right edge of an element is aligned with the right edge of an element.

Category 3: attribute values are specific pixel values, such as 30dip and 40px.
Android: layout_marginbottom distance from the bottom edge of an element
Android: layout_marginleft distance from the left edge of an element
Android: layout_marginright distance from the right edge of an element
Android: layout_margintop distance from the edge of an element

Android: hint of edittext specifies the prompt information in the input box when edittext is null.
Android: gravity
Android: gravity attribute is a limitation on the View content. for example, text on a button. you can set the text to the left and right of the view. take the button as an example. For Android: gravity = "right", the text on the button is right-aligned.
Android: layout_gravity
Android: layout_gravity is used to set the location of the view relative to the parent view. for example, if a button is in linearlayout, you can set it by placing it on the left or right. take the button as an example. For Android: layout_gravity = "right", the button is right-aligned.
Android: scaletype:
Android: scaletype controls how images are resized/moved to match the size of imageview. Imageview. scaletype/Android: the differences between scaletype values:
Center/center is centered according to the original size of the image. When the length/width of the image exceeds the length/width of the view, the center part of the captured image is displayed.
Center_crop/centercrop scales up the image size in the center, so that the image length (width) is equal to or greater than the view length (width)
Center_inside/centerinside shows the entire content of the image in the center. The image length/width is equal to or less than the view length/width by proportional reduction or the original size.
Fit_center/fitcenter scales up/down the image proportionally to the width of the view and center the image.
Fit_end/fitend: scales up or down an image to the width of the view, which is displayed in the lower part of the view.
Fit_start/fitstart scales up/down an image proportionally to the width of the view.
Fit_xy/fitxy increase or decrease the image size proportionally to the view size.
Matrix/matrix is drawn using a matrix to dynamically zoom in and zoom in images.
** Note that the names of images in the drawable folder cannot be capitalized.
Certificate -------------------------------------------------------------------------------------------------------------------------------------------------------------
Android: ID
Specify the corresponding ID for the control
Android: Text
Specify the text displayed in the control. Note that strings in the strings. xml file should be used as much as possible here.
Android: gravity
Specifies the alignment mode of the view component. For example, the center and right positions indicate that the text position in the control is not the control itself.
Android: layout_gravity
Specifies the iner component alignment. for example, if a button is in linearlayout, you can set it by placing it on the left or right. take the button as an example. For Android: layout_gravity = "right", the button is right-aligned.
Android: textsize
Specifies the font size in the control.
Android: Background
Specifies the background color used by the control. The RGB naming method is used.
Android: width
Width of the control
Android: Height
Height of the control
Android: layout_width
Specify the container component width
Android: layout_height
Height of the container component
Android: layout_weight
View is a very important attribute, divided by proportion of space
Android: padding *
Specifies the padding of the control, that is, the content of the control.
Android: sigleline
If set to true, the control content is displayed in the same row.
Android: scaletype
Is to control how the image resized/moved to match the siz of the imageview
Android: layout_centerhrizontal
Horizontal Center
Android: layout_centervertical
Vertical center
Android: layout_centerinparent
Completely centered relative to the parent Element
Android: layout_alignparentbottom
Stick the lower edge of the parent Element
Android: layout_alignparentleft
Attach the left edge of the parent Element
Android: layout_alignparentright
Attach the right edge of the parent Element
Android: layout_alignparenttop
Attach the upper edge of the parent Element
Android: layout_alignwithparentifmissing
If the corresponding sibling element cannot be found, the parent element will be used as a reference object.
Android: layout_below
Below an element
Android: layout_abve
Above an element
Android: layout_toleftof
On the left of an element
Android: layout_torightof
On the Right of an element
Android: layout_aligntop
The top edge of the element is aligned with the top edge of an element.
Android: layout_alignleft
The left edge of the element is aligned with the left edge of an element.
Android: layout_alignbottom
The bottom edge of the element is aligned with the bottom edge of an element.
Android: layout_alignright
The right edge of the element is aligned with the right edge of an element.
Android: layout_marginbottom
Distance from the bottom edge of an element
Android: layout_marginleft
Distance from the left edge of an element
Android: layout_marginright
Distance from the right edge of an element
Android: layout_margintop
Distance from the edge of an element
Android: paddingleft
The distance between the content of the element and the right edge of the element.
Android: paddingright
The distance between the content of the element and the edge of the element.
Android: hint
Prompt information in the input box when edittext is set to null
Android: linearlayout
It determines the direction of linearlayout. Its value can be vertical, indicating the vertical layout of horizontal, indicating the horizontal layout.

Certificate -----------------------------------------------------------------------------------------------------------------------------------------------------
Android: interpolator
There may be many people who don't understand its usage, and the document does not know much about it. In fact, it is very simple. Let's look at the following: interpolator defines the rate of change of an animation ). This allows the basic animation effects (alpha, scale, translate, and rotate) to accelerate, slow down, and repeat. In a plain sense, the animation progress is controlled by interpolator. Interpolator defines the speed at which an animation changes, including constant speed, positive acceleration, negative acceleration, and irregular acceleration. Interpolator is a base class that encapsulates all the common methods of interpolator. It has only one method, that is, getinterpolation (float input ), this method maps a point on the timeline to a multiplier to be applied to the transformations of an animation. Android provides several interpolator subclasses to achieve different speed curves, as shown below:
The acceleratedecelerateinterpolator speed changes slowly at the beginning of the animation and the introduced place, accelerating
Accelerateinterpolator changes slowly at the beginning of the animation, and then starts acceleration.
Cycleinterpolator: specifies the number of times the animation is played cyclically, and the speed changes along the sine curve.
Decelerateinterpolator speed changes slowly at the beginning of the animation, and then starts to slow down
Linearinterpolator changes at an even rate in the animation
For linearinterpolator, the change rate is a constant, that is, f (x) = x.
Public float getinterpolation (float input ){
Return input;
}
The other sub-classes of interpolator are also based on the specificAlgorithm, To achieve the change rate. You can also define your own interpolator subclass to achieve physical effects such as parabolic and free-falling.

Related Article

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.