Android Layout Properties

Source: Internet
Author: User

1) Layout-related properties

①android:layout_weight= "1.0", Layout_weight is used to assign values to many of the view's importance in a linear layout. All views have a layout_weight value, which defaults to zero, meaning how much screen space you need to show how large the view will occupy. If you assign a value above zero, the free space in the parent view is split, and the split size depends on the layout_weight value of each view and the overall layout_weight value of the value in the current screen layout and the layout_ of the other view screen layout The percentage of the weight value. For example, I have a text label and two text editing elements in the horizontal direction. The text label does not specify a layout_weight value, so it will occupy the minimum space needed to provide it. If the layout_weight value of each of the two text-editing elements is set to 1, the two are split equally between the remaining widths of the parent view layout (since we declare the two to be of equal importance). If two text editing elements where the first Layout_weight value is set to 1, and the second is set to 2, then two-thirds of the remaining space is given to the first, and One-third points to the second (the smaller the value, the higher the importance)

②android:gravity--is used to control the position of the text inside the EditText

③android:drawabletop--is to place the picture above a component (relativelayout the meaning of each property ③-?)

④android:layout_above= "@id/xxx"-puts the control on top of the given ID control

⑤android:layout_below= "@id/xxx"-places the control under the given ID control

⑥android:layout_toleftof= "@id/xxx"-Aligns the right edge of the control with the left edge of the given ID control

⑦android:layout_torightof= "@id/xxx"-aligns the left edge of the control with the right edge of the given ID control

⑧android:layout_alignleft= "@id/xxx"-aligns the left edge of the control with the left edge of the given ID control

⑨android:layout_aligntop= "@id/xxx"-aligns the top edge of the control with the top edge of the given ID control

⑩android:layout_alignright= "@id/xxx"-Aligns the right edge of the control with the right edge of the given ID control

android:layout_alignbottom= "@id/xxx"-Aligns the bottom edge of the control with the bottom edge of the given ID control

Android:layout_alignparentleft= "true"-aligns the left edge of the control with the left edge of the parent control

Android:layout_alignparenttop= "true"-aligns the top edge of the control with the top edge of the parent control

Android:layout_alignparentright= "true"-aligns the right edge of the control with the right edge of the parent control

Android:layout_alignparentbottom= "true"-aligns the bottom edge of the control with the bottom edge of the parent control

Android:layout_centerinparent= "true"--places the control in the center of the parent control

Android:layout_centerhorizontal= "true"--places the control in the center of the horizontal direction

Android:layout_centervertical= "true"--places the control in the center of the vertical direction

Android:layout_marginbottom= "10px" or "10dip"--the distance from the bottom edge of an element

android:layout_marginleft= "10px" or "10dip"-the distance from the left edge of an element

android:layout_marginright= "10px" or "10dip"--distance from the right edge of an element

android:layout_margintop= "10px" or "10dip"-the distance from the top edge of an element

Android:hint= ""--set the prompt message in the input box when EditText is empty

android:screenorientation= "Portrait"--Specify screen as vertical screen

android:screenorientation= "Landscape"--Specify screen as horizontal screen

Android:capitalize--Set the English letter capitalization type android:cursorvisible set the cursor to show

Android:digits--sets which characters are allowed to be entered. such as "123456&*"

android:drawablebottom:--output A drawable below the text. If the color is set to the background color

android:drawableleft:--output a drawable to the left of text.

android:drawableright:--output a drawable to the right of text.

android:drawabletop:--outputs a drawable at the top of the text.

Android:editable--Set whether editable

Android:editorextras--Set additional input data for the text.

Android:ellipsize--Set when the text is too long, how the control is displayed, with the following properties the start ellipsis is displayed at the beginning of the end ellipsis at the end of the middle ellipsis in the middle marquee with a marquee display (animation lateral movement)

Android:ems--Sets the width of the textview width to n characters android:freezestext set the contents of the saved text and the cursor built-in

Android:includefontpadding--Set whether text contains extra white space at the top and bottom, which is true by default

PNS Android:inputmethod--Specify input method for text, require fully qualified name (full package name)

Android:inputtype--Set the type of Guangxi to help the input method display the appropriate keyboard type

Android:lines--Set the number of lines of text display Android:linespacingextra set line spacing

Android:linespacingmultiplier--Sets the multiple of the line spacing

Android:linksclickable--Set whether the link clicks the connection, even if the Autolick is set

Android:marqueerepeatlimit--Sets the number of repeated scrolls in the case specified by Ellipsize. When setting Marquee_forever last means infinite times

Android:maxems--Sets the width of the textview to a maximum of n characters. Overwrite EMS option when used in conjunction with EMS

Android:maxheight--Set the maximum height of the text area

Android:maxlength--Limit the length of text that is displayed, and the excess part is not displayed.

Android:maxlines--Sets the maximum number of lines of text to display, used in conjunction with width or layout_width, beyond the partial wrap, and the number of lines beyond will not be displayed.

Android:maxwidth--Set the maximum width of the text area

Android:minems--Sets the width of the textview to a minimum of n characters. Overwrite EMS option when used with EMS.

Android:minheight--Set the minimum height of the text area

Android:minlines--Sets the minimum number of lines of text, similar to lines. Android:minwidth Setting the minimum width of the text area

Wuyi Android:numeric--if set, the TextView has a digital input method. Android:password with a small dot "." Display text

Android:phonenumber--Set as input for phone number Android:privateimeoptions set Input method options

Android:scrollhorizontally--If the text exceeds the width of the TextView, the horizontal pull bar appears

Android:selectallonfocus-If the text is selectable, let him focus instead of moving the cursor to the beginning or end of the text. No effect after setting in TextView.

Android:shadowcolor--Specifies the color of the text shadow and needs to be used with Shadowradius

ANDROID:SHADOWDX--Sets the start position of the shadow horizontal coordinates. Android:shadowdy sets the start position of the shadow vertical coordinates.

Android:shadowradius--Set the radius of the shadow. Set to 0.1 to become the color of the font, generally set to 3.0 effect is better.

Android:singleline--Set the single-line display. If used with Layout_width, when the text cannot be displayed in its entirety, it is followed by "...". such as android:text= "Test_ Singleline"

Adnroid:stretchcolumns--Specify the number of columns in the Tablelayout as a stretch (when filling out the screen) Android:text set the display text.

Android:textsize--Set text size, recommended unit of measure "SP" or "PT"

Android:textstyle--Set glyph [Bold (bold) 0, Italic (italic) 1, bolditalic (coarse and oblique) 2] You can set one or more, with "|" Separated

Android:typeface--Set text font, must be one of the following constant values: normal 0, sans 1, serif 2, monospace (equal width font) 3

Android:width--Sets the width of the text area, supports the unit of measure: px (pixels)/dp/sp/in/mm (mm), and the difference between layout_width see here.

Android:scaletype--such as Imageview.setscaletype (ImageView.ScaleType.FIT_XY)
Center/center is centered on the original size of the image, and when the picture is longer/wider than the length/width of the view, the center portion of the image is displayed
Center_crop/centercrop proportionally enlarges the size of the image so that the image is long (wide) equal to or greater than the length (width) of the view
Center_inside/centerinside Displays the contents of the picture in full, by scaling it down or the original size to make 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 Zoom In/out to the width of the view, displayed in the lower part of the view
Fit_start/fitstart Enlarge/Shrink the image 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
Matrix/matrix using matrices to draw

Android Layout Properties

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.