Android edittext Common Properties feature Rollup _android

Source: Internet
Author: User
Tags gettext numeric

This paper summarizes and analyzes the common properties of Android EditText. Share to everyone for your reference, specific as follows:

Android:hint= "Please enter a number!" "//Set the message displayed on the space
android:numeric= "integer"//settings can only enter integers, if decimal is: decimal
Android:singleline= "true"//sets the single line input, and once set to true, the text does not wrap automatically.
Android:password= "true"//setting can only enter a password
Android:textcolor = "#ff8c00"//Font Color
Android:textstyle= "bold"//font, bold, italic, Bolditalic
Android:textsize= "20dip"//Size
Android:capitalize = "Characters"//written in uppercase letters
android:textalign= "center"//edittext does not have this attribute, but TextView has, centered
android:textcolorhighlight= "#cccccc"//The background of the selected text, the default is blue
Android:textcolorhint= "#ffff00"//Set the color of the hint message text, the default is the gray android:textscalex= "1.5"//control the spacing between words
Android:typeface= "monospace"//font, normal, sans, serif, monospace
Android:background= "@null"//background, not here, means transparent
android:layout_weight= "1"//weights, control the status between controls, it is useful to control the size of the control display.
Android:textappearance= "? Android:attr/textappearancelargeinverse"//Text appearance
android:layout_gravity= "center_vertical"//Set the position of the control display: Default top, centered here, and bottom

android:gray= "Top"/"Multi-line" pointer in first row position

Et.setselection (Et.length ());//adjust cursor to last line

Android:autotext//Automatic spell Help

Android:capitalize//First Letter Capital

Android:digits//settings only accept certain numbers

android:singleline//whether a single line or multiple lines, enter the text box or text box to add new lines

Android:numeric//Only accept numbers

Android:phonenumber//Enter phone number

Android:editable//Is editable

android:autolink= "All"//Set text hyperlink style when you click on the URL, skip to the URL

Android:textappearance= "? Android:attr/textappearancelargeinverse"//text appearance, which refers to the system's own appearance,? Indicates whether the system has this appearance, otherwise the default appearance is used. I don't know if that's the right idea.

Attribute Name Description

Android:autolink whether the text is displayed as a clickable link when the text is a URL link/email/phone number/map. Optional value (None/web/email/phone/map/all)

Android:autotext if set, the spelling correction for the input value is automatically performed. No effect here, it works when the input input is displayed.

ANDROID:BUFFERTYPE Specifies the type of text that the GetText () method obtains. The option editable is similar to StringBuilder can append characters,

That is, GetText can call the Append method to set the text content. Spannable You can use styles in a given character area.

Android:capitalize sets the English letter capitalization type. No effect here, you need to eject the input method to see it, see editview this property description.

Android:cursorvisible set cursor for show/hide, default display.

The Android:digits setting allows you to enter which characters. such as "1234567890.+-*/% ()"

Android:drawablebottom prints a drawable below the text, such as a picture. If you specify a color, the text background is set to the color, and the latter is overwritten with background.

Android:drawableleft prints a drawable on the left side of the text, such as a picture.

Android:drawablepadding sets the spacing between text and drawable (picture), and is used in conjunction with Drawableleft, Drawableright, Drawabletop, Drawablebottom, Can be set to a negative number, with no effect alone.

Android:drawableright prints a drawable on the right side of the text, such as a picture.

Android:drawabletop outputs a drawable, such as a picture, above the text.

Whether the android:editable setting is editable. There is no effect here, see EditView.

Android:editorextras sets the additional input data for the text. Discuss it again in EditView.

Android:ellipsize sets how the control should appear when the text is too long. The following values are set: "Start"-? ellipses appear at the beginning; End "--the ellipsis is displayed at the ending;" Middle "--the ellipsis is shown in the middle;" Marquee "--display in the way of a horse lamp (animation moving horizontally)

Android:freezestext sets the contents of the saved text and the position of the cursor.

Android:gravity sets the text position, as set to "center," and the text is centered.

Android:hinttext the text message displayed when the space is empty, you can set the color of the hint message by Textcolorhint. This property is used in EditView, but can also be used here.

Android:imeoptions additional function, set the lower right corner IME action related to the edit box action, such as Actiondone in the lower right corner will display a "finish" instead of setting the default is a carriage return symbol. This is explained in detail in the EditView, which is useless here.

Android:imeactionid Sets the IME action ID. Make a note in EditView.

Android:imeactionlabel Sets the IME action label. Make a note in EditView.

Android:includefontpadding sets whether the text contains extra white space at the top and bottom, and defaults to true.

ANDROID:INPUTMETHOD specifies the input method for text, requiring a fully qualified name (the full package name). For example: Com.google.android.inputmethod.pinyin, but here the error is not found.

Android:inputtype sets the type of text to help the input method display the appropriate keyboard type. In EditView, there is no effect.

Android:linksclickable set the link to click on the connection, even if setting the Autolink.

Android:marqueerepeatlimit sets the number of repeat scrolling when ellipsize specifies marquee, which is infinite when set to Marquee_forever.

Android:ems sets the width of the TextView to n characters. This test is for a character width of Chinese characters.

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

Android:minems sets the width of the textview to a minimum of n characters. Override the EMS option when used in conjunction with EMS.

Android:maxlength limits the length of text that is displayed and is not displayed beyond the section.

Android:lines sets the number of lines of text, setting two lines to display two lines, even if there is no data in the second row.

Android:maxlines sets the maximum number of lines of text to display, in conjunction with the width or layout_width, which exceeds the number of wrapping lines, and does not show up.

Android:minlines sets the minimum number of lines of text, similar to lines.

Android:linespacingextra sets the line spacing.

Android:linespacingmultiplier sets the multiple of line spacing. such as "1.2"

Android:numeric if it is set, the TextView has a numeric input method. This is useless, the only effect after setting is TextView has a click Effect, this property will be detailed in Edtiview.

Android:password with a small dot "." Display text

Android:phonenumber is set to the way the phone number is entered.

Android:privateimeoptions setting Input method options, which are useless here, will be discussed further in EditText.

android:scrollhorizontally If the text is set to exceed the width of the TextView, the horizontal pull bar appears.

Android:selectallonfocus If the text is selectable, let him get 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, which needs to be used with Shadowradius.

ANDROID:SHADOWDX sets the position of the shadow's horizontal coordinates to begin.

Android:shadowdy sets the position of the shadow portrait coordinates to begin.

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

Android:singleline set up a single-line display. If used with Layout_width, when the text cannot be all displayed, the following is indicated by "...". such as android:text= "Test_ singleline" android:singleline= "true" android:layout_width= "20DP" will only show "t ...". If you do not set Singleline or false, the text wraps automatically.

ANDROID:SHADOWDX sets the position of the shadow's horizontal coordinates to begin.

Android:shadowdy sets the position of the shadow portrait coordinates to begin.

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

Android:singleline set up a single-line display. If used with Layout_width, when the text cannot be all displayed, the following is indicated by "...". such as android:text= "Test_ singleline" android:singleline= "true" android:layout_width= "20DP" will only show "t ...". If you do not set Singleline or false, the text wraps automatically.

Android:text sets the display text.

Android:textsize set the text size, recommend the unit of measure "SP", such as "15SP"

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

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

Android:height set the height of the text area, support unit of measure: px (pixel)/dp/sp/in/mm (mm)

Android:maxheight sets the maximum height of the text area

Android:minheight sets the minimum height of the text area

Android:width sets the width of the text area, which supports the unit of measure: px (pixel)/dp/sp/in/mm (mm).

Android:maxwidth sets the maximum width of the text area

Android:minwidth sets the minimum width of the text area

Android:textappearance sets the appearance of the text. Like "? Android:attr/textappearancelargeinverse" here refers to the system's own appearance,? Indicates whether the system has this appearance, otherwise the default appearance is used.

For more information on Android-related content readers can view the site: "The Android thread and message mechanism usage Summary", "Android programming activity Operation Skills Summary", "Android debugging techniques and common problems solution summary", " Android Development Primer and Advanced tutorials, Android Multimedia how-to summary (audio, video, recording, etc), summary of Android Basic components usage, Android View view tips, Android layout layout tips and A summary of the usage of Android controls

I hope this article will help you with the Android program.

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.