Simple analysis of property settings for Android TextView XML

Source: Internet
Author: User

Android:ems sets the width of the TextView to n characters.

The advantage is that you can set the width of the edit box based on a fixed value when you define how many characters to enter in the edit box space. Ensure that the border and text width are uniform.
Android:maxems sets the width of the textview to a maximum of n characters. Overwrite EMS option when used with EMS.

The move is also a certain limit on the number of data that controls the text.
Android:minems sets the width of the textview to a minimum of n characters. Overwrite EMS option when used with EMS.

Ditto
Android:maxlength limit the number of input characters. If set to 5, then only 5 characters/digits/letters can be entered.

Ditto
Android:lines sets the number of lines of text, two lines are displayed, even if the second row has no data.

Ditto
Android:maxlines sets the maximum number of lines of text to display, in combination with width or layout_width, beyond the partial wrap, and the number of lines beyond will not be displayed.
Android:minlines sets the minimum number of lines of text, similar to lines.
Android:linespacingextra sets the line spacing.

The attributes that are often used in the ranking
Android:linespacingmultiplier sets the multiple of line spacing. such as "1.2"

Ditto
Android:numeric if set, the TextView has a digital input method. The following values are set: Integer positive integer, signed signed integer, decimal with decimal point floating point number.
Android:password with a small dot "." Display text

Android comes with a form format that works well
Android:phonenumber is set as the input for the phone number.

So many things do not have to be set in the code. Directly more different from the needs you give, make the XML property settings on it.

Android:singleline sets 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" android:singleline= "true" android:layout_width= "20DP" will show only "t ...". If you do not set Singleline or set to False, the text wraps automatically


Android:textappearance to set the appearance of text. As "? Android:attr/textappearancelargeinverse" here refers to the system comes with an appearance,? Indicates whether the system has this appearance, otherwise the default appearance is used. The values you can set are as follows:

Textappearancelargeinverse

Textappearancebutton

Textappearanceinverse

Textappearancelarge

Textappearancelargeinverse

Textappearancemedium

Textappearancemediuminverse

Textappearancesmall

Textappearancesmallinverse

Android:textcolor Setting text color

Common Properties
Android:textcolorhighlight the background of the selected text, the default is blue

Common Properties
Android:textcolorhint sets the color of the hint text, which is grayed out by default. Used in conjunction with hint.

Common Properties
Android:textcolorlink the color of the text link.

Common Properties
Android:textscalex set the spacing between text, which defaults to 1.0f. See also the TextView.

Common Properties
Android:textsize set text size, recommended unit of measure "SP", such as "15SP"

Common Properties
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 the text font, must be one of the following constant values: normal 0, sans 1, serif 2, monospace (equal width font) 3]


Android:height Setting the height of the text area, support measurement: px (pixels)/dp/sp/in/mm (mm)
Android:maxheight Setting the maximum height of the text area
Android:minheight Setting the minimum height of the text area
Android:width sets the width of the text area, supported by the measurement: px (pixels)/dp/sp/in/mm (mm), and the difference between layout_width look here.
Android:maxwidth Setting the maximum width of the text area
Android:minwidth Setting the minimum width of the text area

Simple analysis of property settings for Android TextView XML

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.