Android edit box (EditText) attribute learning

Source: Internet
Author: User

EditText Inheritance Relationship: View-->textview-->edittext

  the properties of EditText are very numerous, here are a few:
Android:hint= "Please enter a number!" "//Set the information displayed on the space
Android:numeric= "integer"//setting can only enter integers, assuming decimals is: decimal
Android:singleline= "true"//Set single-line input. Once set to True. The text will not be wrapped on its own initiative.
Android:password= "true"//settings can only enter the password
Android:textcolor= "#ff8c00"//Font Color
Android:textstyle= "bold"//font. Bold, italic, Bolditalic
android:textsize= "20dip"//Size
android:capitalize= "Characters"//write in uppercase letters
android:textalign= "Center"//edittext does not have this attribute. But TextView there, centered
Android:textcolorhighlight= "#cccccc"//The background of the selected text, the default feeling blue
Android:textcolorhint= "#ffff00"//Set the color of the message text, android:textscalex= "1.5"//control the spacing between the word and the word
Android:typeface= "monospace"//font, normal, sans, serif, monospace (standard, sans serif font, serif font, equal width font)
Android:background= "@null"//background, not here. Refers to Transparent
Android:layout_weight= "1"//weight. Controls the position between controls, which is useful when controlling the size of the control display.


android:textappearance= "? android:attr/textappearancelargeinverSe "//Text appearance
android:layout_gravity= "Center_vertical"//sets the position of the control to display: Default top. It's centered here, and there's bottom.

android:gray= "Top"//multi-line pointer on first row first position

et.setselection (Et.length ());//Adjust the cursor to the last line

Android:autotextHelp yourself by actively spelling

android:capitalizeCapitalize first letter

android:digitsSet to accept only certain numbers

Android:singlelineWhether a single line or multiple rows, enter is to leave the text box or text box to add a new line

Android:numericJust accept the numbers

Android:phonenumberEnter phone number

android:editableWhether it can be edited

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

android:textappearance= "? android:attr/textappearancelargeinverSe "//text appearance, which refers to the system comes with an appearance,? Indicates whether the system has this appearance, otherwise the default appearance is used.

Do not know that this understanding is not correct?
   

 Descriptive description of attribute names

  Android:autolink Sets whether text is displayed as a clickable link when the text is a URL link/email/phone number/map.

Selectable VALUES (None/web/email/phone/map/all)

  The Android:autotext assumes that the spelling of the input value will be set on its own initiative. There is no effect here, it works when the input method is displayed and entered.



  Android:buffertype Specifies the text category that is obtained by the GetText () method.

The option editable is similar to the StringBuilder append character,

That is, you can call the Append method to set the text content after gettext.

Spannable can use the style in a given character area, see here 1, here 2.

  android:capitalize Set the English letter capitalization type. There is no effect, need to pop input method talent to see. See EditView this property description.

  android:cursorvisible set cursor to show/hide, default display.

  android:digits Sets which characters are agreed to enter. such as "1234567890.+-*/% ()"

  The android:drawablebottom outputs a drawable below the text. Chip

If you specify a color, the background of text is set to that color. And the same time and background when used to cover the latter.

  android:drawableleft outputs a drawable to the left of text. Chip



  android:drawablepadding Sets the interval between text and drawable (picture). Used with Drawableleft, Drawableright, Drawabletop, Drawablebottom, can be set to negative numbers, use alone no effect.

android:drawableright output a drawable on the right side of the text, a piece.

The android:drawabletop outputs a drawable, a slice, directly above the text.



android:editable Whether the settings are editable.

There is no effect here, see EditView.



Android:editorextras Sets the additional input data for the text. discussed again in EditView.

android:ellipsize Sets how the control is displayed when the text is too long. There are for example the following value settings: "Start"-?

The ellipsis appears at the beginning; End "--the ellipsis appears at the end; Middle "--the ellipsis appears in the middle; Marquee "--display in the form of a marquee (animated lateral movement)

android:freezestext Sets the contents of the saved text and the position of the cursor. See: here.



android:gravity Set the text position, as set to "center". The text appears centered.



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

android:imeoptions Additional functions, set the action associated with the edit box for the IME action in the lower right corner. A "complete" is displayed in the lower right corner of the actiondone, and a carriage return symbol is not set by default. This is explained in detail in the EditView. Useless here.

Android:imeactionid Set the IME action ID.

In EditView again to do the explanation, can read this post first: here.

Android:imeactionlabel Set the IME action label.

Explain it again in EditView.


android:includefontpadding Sets whether the text includes the top and bottom extra blanks, which defaults to true.
Android:inputmethod Specifies the input method for the text. A fully qualified name (full package name) is required.

For example: Com.google.android.inputmethod.pinyin. But the error is not found here.
android:inputtype sets the type of text. Used to help the input method display the appropriate keyboard type. In the EditView, it is no longer effective to specify.
android:linksclickable sets whether links click Connect. Even if the Autolink is set.


Android:marqueerepeatlimit Sets the number of times to scroll repeatedly when ellipsize specifies marquee, which is expressed indefinitely when set to Marquee_forever.
android:ems Sets the width of the TextView to n characters. Here the test is a Chinese character width,
android:maxems Sets the width of the textview to a maximum of n characters. Overwrite the EMS option with EMS at the same time.
android:minems Sets the width of the textview to a minimum of n characters. Overwrite the EMS option with EMS at the same time.
android:maxlength limits the length of text that is displayed, and the excess portion is not displayed.


android:lines Sets the number of lines of text. Two rows are set to display two rows, even if the second row has no data.


android:maxlines Sets the maximum number of lines of text, used in conjunction with width or layout_width, to break out of the section itself, and the number of rows beyond will not be displayed.
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"
The android:numeric hypothesis is set. The TextView has a digital input method.

It is useless here, the only effect after setting is TextView has the click Effect, this property will be specified in Edtiview.
Android:password with a small dot "." Display text
Android:phonenumber is set as the input for the phone number.


android:privateimeoptions set IME options. This is useless here and will be discussed further in EditText.


android:scrollhorizontally If the text exceeds the width of the TextView, the horizontal pull bar appears.


Android:selectallonfocus assumes that the text is selectable so that he gets the 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. Effect:

ANDROID:SHADOWDX Sets the start position of the shadow's horizontal coordinates.

android:shadowdy Sets the start position of the shadow longitudinal coordinates.

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



android:singleline Sets the single-line display.

Assumed to be used in conjunction with Layout_width. When the text is not all displayed, it is later denoted by "...". such as android:text= "Test_ singleline" android:singleline= "true" android:layout_width= "20DP" will simply show "t ...".

Assuming the singleline is not set or set to False, the text wraps itself.

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

Android:shadowdy sets the start position of the shadow longitudinal coordinates.

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

Android:singleline sets the single-line display. Assume that it is used with layout_width, when the text is not all displayed, followed by "...". such as android:text= "Test_ singleline" android:singleline= "true" android:layout_width= "20DP" will simply show "t ...". Assume that Singleline is not set or set to False. Text will take its own initiative to wrap

Android:text sets the display text.

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

Android:textstyle set glyph [Bold (bold) 0, Italic (italic) 1, bolditalic (coarse and oblique) 2] 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. Support units of measure: px (pixels)/dp/sp/in/mm (mm), the difference with layout_width look here.

Android:maxwidth Setting the maximum width of the text area

Android:minwidth Setting the minimum width of the text area

Android:textappearance to set the appearance of text. such as "? Android:attr/textappearancelargeinverSe "refers to a system that comes with a look.?

Indicates whether the system has this appearance. Otherwise, the default appearance is used. The values you can set are as follows : Textappearancebutton/textappearanceinverse/textappearancelarge/textappearancelargeinver se/textappearancemedium/textappearancemediuminverse/textappearancesmall/ TextappearancesmallinverSE

Android:textappearance to set the appearance of text.

such as "?android:attr/textappearancelargeinver SE

"Here is a reference to the system comes with a look."

Indicates whether the system has this appearance, otherwise the default appearance is used. The values you can set are as follows:

Textappearancebutton/textappearanceinverse/textappearancelarge/textappearancelargeinverSE

Android edit box (EditText) attribute learning

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.