Android: edittext attributes

Source: Internet
Author: User
Edittext inheritance relationship: View --> textview --> edittext
Edittext has many attributes. Here we will introduce several attributes:
Android: Background = "@ null" // edittext remove border
Android: hint = "enter a number! "// Set the prompt information displayed on the space
Android: Numeric = "integer" // you can only enter an integer. If it is a decimal
Android: singleline = "true" // you can specify a single-line Input. If this parameter is set to true, text is not automatically wrapped.
Android: Password = "true" // you can only enter a password.
Android: textcolor = "# ff8c00" // font color
Android: textstyle = "bold" // font, bold, italic, bolditalic
Android: textsize = "20dip" // size
Android: Capitalize = "characters" // write with uppercase letters
Android: textalign = "center" // edittext does not have this attribute, but textview has and is centered.
Android: textcolorhighlight = "# cccccc" // specifies the background color of the selected text. The default value is blue.
Android: textcolorhint = "# FFFF00" // sets the text color of the prompt message. The default color is gray. Android: textscalex = "1.5" // controls the spacing between words.
Android: Typeface = "monospace" // font, normal, SANS, Serif, monospace
Android: Background = "@ null" // background, which does not exist here. It is transparent.
Android: layout_weight = "1" // weight, controls the status between controls, and is quite useful when the control is displayed.
Android: textappearance = "? Android: ATTR/textappearancelargeinver Se "// text appearance
Android: layout_gravity = "center_vertical" // you can specify the display position of the control: Top by default. Bottom is displayed in the center.
Android: Gray = "TOP" // the pointer is at the first position of the first row in multiple rows
Et. setselection (ET. Length (); // adjust the cursor to the last row
Android: AutoText // help for automatic spelling
Android: Capitalize // uppercase
Android: digits // set to only accept certain numbers
Android: singleline // whether a single line or multiple lines are supported. Press enter to leave the text box or Add a new line in the text box.
Android: Numeric // only accept numbers
Android: phonenumber // enter the phone number
Android: editable // whether to edit
Android: autolink = "all" // sets the text hyperlink style. When a URL is clicked, it jumps to the URL.
Android: textappearance = "? Android: ATTR/textappearancelargeinver Se "// text appearance. Here it refers to the appearance of the system ,? Indicates whether the system has this appearance. Otherwise, the default appearance is used. I don't know, do you?

Attribute Name Description
Android: autolink // sets whether the text is displayed as a clickable link when the text is URL link, email, phone number, or map. Optional values (None/web/email/phone/MAP/All)
Android: AutoText // If set, the spelling of the input value is automatically corrected. There is no effect here. It works when the input method is displayed and entered.
Android: buffertype // specify the text category obtained by gettext. The editable option is similar to the append character of stringbuilder. That is to say, after gettext, you can use the append method to set the text content. Spannable can use styles in a given character area. For more information, see 1. 2.
Android: Capitalize // you can specify uppercase letters for an English letter. There is no effect here. The input method needs to be popped up to see it. For details, see editview this attribute description.
Android: cursorvisible // set the cursor to show/hide. The default value is displayed.
Android: digits // you can specify the characters that can be entered. For example, "1234567890. +-*/% ()"
Android: drawablebottom // output a drawable under text. If a color is specified, the background of the text is set to this color, and the latter is overwritten with the background.

Android: drawableleft // output a drawable on the left of text.

Android: drawablepadding // sets the interval between text and drawable (image). It can be used with drawableleft, drawableright, drawabletop, and drawablebottom. It can be set to negative.
Android: drawableright // output a drawable on the Right of text.
Android: drawabletop // output a drawable on the top of the text.
Android: editable // set whether to edit. No effect. For more information, see editview.
Android: editorextras // sets additional input data for text. We will discuss it again in editview.
Android: ellipsize // set how to display the control when the text is too long. Set the following values: "Start "-? The ellipsis is displayed at the beginning; "end" -- The ellipsis is displayed at the end; "Middle" -- The ellipsis is displayed in the middle; "marquee" -- displayed in the form of a marquee (horizontal animation Movement)
Android: freezestext // set the content of the saved text and the cursor position. See: Here.

Android: gravity // set the text location. If it is set to "center", the text is displayed in the center.

Android: hinttext // text prompt information displayed when it is null. You can use textcolorhint to set the color of the prompt information. This attribute is used in editview, but it can also be used here.

Android: imeoptions // additional function. It sets the ime action in the lower right corner and the action related to the edit box. For example, a "finish" is displayed in the lower right corner of actiondone, without setting a carriage return symbol by default. This is described in detail in editview, Which is useless here.

Android: imeactionid // sets the ime action ID. Let's explain it again in editview. You can read this post first: Here.

Android: imeactionlabel // sets the ime action label. In editview, describe it again.

Android: includefontpadding // sets whether the text contains additional white space at the top and bottom. The default value is true.

Android: inputmethod // specify the Input Method for text. You must specify the full package name ). For example, Com. Google. Android. inputmethod. Pinyin, but the error cannot be found.

Android: inputtype // sets the text type to help the input method display the appropriate keyboard type. Detailed description in editview, no effect here.

Android: linksclickable // sets whether the link is connected even if autolink is set.

Android: marqueerepeatlimit // when marquee is specified in ellipsize, the number of repeated scrolling times is set. When marquee_forever is set, the number of times is unlimited.

Android: EMS // set the textview width to n characters. The test here is a Chinese character width,

Android: maxems // set the textview width to a maximum of n characters. Overwrite the EMS option when used with EMS.

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

Android: maxlength // restrict the length of the displayed text. The excess part is not displayed.

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

Android: maxlines // sets the maximum number of lines displayed in the text, which is used in combination with width or layout_width. If the line exceeded is automatically wrapped, the line exceeded is not displayed.

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

Android: linespacingextra // you can specify the row spacing.

Android: linespacingmultiplier // set a multiple of the line spacing. For example, "1.2"

Android: Numeric // If set, the textview has a digital input method. This is useless. The only effect after setting is that textview has a click effect. This attribute is described in detail in edtiview.

Android: Password // use a small dot "." To display text

Android: phonenumber // set it to the phone number input method.

Android: privateimeoptions // set the input method options, which is useless here and will be further discussed in edittext.

Android: scrollhorizontally // set whether to display a horizontal bar when the text exceeds the textview width.

Android: selectallonfocus // if the text is selectable, let him get the focus instead of moving the cursor to the start or end of the text. After being set in textview, there is no effect.

Android: shadowcolor // specifies the color of the text shadow, which must be used with shadowradius. Effect:

Android: shadowdx // sets the start position of the Shadow horizontal coordinate.

Android: shadowdy // set the start position of the Shadow vertical coordinate.

Android: shadowradius // set the shadow radius. If it is set to 0.1, it becomes the font color. Generally, it is better to set it to 3.0.

Android: singleline // sets the display of a single row. If it is used with layout_width, when the text cannot be fully displayed, "…" is used later. . For example, Android: text = "test _ singleline" Android: singleline = "true" Android: layout_width = "20dp" only displays "T ...". If singleline is not set or is set to false, the text will wrap automatically.

Android: shadowdx // sets the start position of the Shadow horizontal coordinate.

Android: shadowdy // set the start position of the Shadow vertical coordinate.

Android: shadowradius // set the shadow radius. If it is set to 0.1, it becomes the font color. Generally, it is better to set it to 3.0.

Android: singleline // sets the display of a single row. If it is used with layout_width, when the text cannot be fully displayed, "…" is used later. . For example, Android: text = "test _ singleline" Android: singleline = "true" Android: layout_width = "20dp" only displays "T ...". If singleline is not set or is set to false, the text will wrap automatically.

Android: Text // set to display text.

Android: textsize // set the text size. The recommended measurement unit is "SP", for example, "15sp"

Android: textstyle // you can specify one or more Font types in the [bold (BOLD) 0, italic (italic) 1, and bolditalic (bold and oblique) 2, separated by "|"

Android: Typeface // set the text font, which must be one of the following constant values: normal 0, sans 1, Serif 2, monospace (same width font) 3]

Android: height // sets the height of the text area. supported measurement units: Px (pixels)/DP/SP/In/mm (millimeters)

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. The unit of measurement is PX (pixel)/DP/SP/In/mm (mm). The difference from layout_width is shown here.

Android: maxwidth // set the maximum width of the text area

Android: minwidth // set the minimum width of the text area

Android: textappearance // set the text appearance. Such as "? Android: ATTR/textappearancelargeinverSe

"Here is a built-in system appearance ,? Indicates whether the system has this appearance. Otherwise, the default appearance is used. Configurable values: textappearancebutton/textappearanceinverse/textappearancelarge/textappearancelargeinverSE/textappearancemedium/textappearancemediuminveRSE/textappearancesmall/textappearancesmallinverSe

Android: textappearance // set the text appearance. Such as "? Android: ATTR/textappearancelargeinverSe

"Here is a built-in system appearance ,? Indicates whether the system has this appearance. Otherwise, the default appearance is used. Configurable values: textappearancebutton/textappearanceinverse/textappearancelarge/textappearancelargeinverSE/textappearancemedium/textappearancemediuminveRSE


Android: Capitalize // you can specify uppercase letters for an English letter. There is no effect here. The input method needs to be popped up to see it. For details, see editview this attribute description.
Android: cursorvisible // set the cursor to show/hide. The default value is displayed.
Android: digits // you can specify the characters that can be entered. For example, "1234567890. +-*/% ()"
Android: drawablebottom // output a drawable under text. If a color is specified, the background of the text is set to this color, and the latter is overwritten with the background.
Android: drawableleft // output a drawable on the left of text.
Android: drawablepadding // sets the interval between text and drawable (image). It can be used with drawableleft, drawableright, drawabletop, and drawablebottom. It can be set to negative.
Android: drawableright // output a drawable on the Right of text.
Android: drawabletop // output a drawable on the top of the text.
Android: editable // set whether to edit. No effect. For more information, see editview.
Android: editorextras // sets additional input data for text. We will discuss it again in editview.
Android: ellipsize // set how to display the control when the text is too long. Set the following values: "Start "-? The ellipsis is displayed at the beginning; "end" -- The ellipsis is displayed at the end; "Middle" -- The ellipsis is displayed in the middle; "marquee" -- displayed in the form of a marquee (horizontal animation Movement)
Android: freezestext // set the content of the saved text and the cursor position. See: Here.
Android: gravity // set the text location. If it is set to "center", the text is displayed in the center.
Android: hinttext // text prompt information displayed when it is null. You can use textcolorhint to set the color of the prompt information. This attribute is used in editview, but it can also be used here.
Android: imeoptions // additional function. It sets the ime action in the lower right corner and the action related to the edit box. For example, a "finish" is displayed in the lower right corner of actiondone, without setting a carriage return symbol by default. This is described in detail in editview, Which is useless here.
Android: imeactionid // sets the ime action ID. Let's explain it again in editview. You can read this post first: Here.
Android: imeactionlabel // sets the ime action label. In editview, describe it again.
Android: includefontpadding // sets whether the text contains additional white space at the top and bottom. The default value is true.
Android: inputmethod // specify the Input Method for text. You must specify the full package name ). For example, Com. Google. Android. inputmethod. Pinyin, but the error cannot be found.
Android: inputtype // sets the text type to help the input method display the appropriate keyboard type. Detailed description in editview, no effect here.
Android: linksclickable // sets whether the link is connected even if autolink is set.
Android: marqueerepeatlimit // when marquee is specified in ellipsize, the number of repeated scrolling times is set. When marquee_forever is set, the number of times is unlimited.
Android: EMS // set the textview width to n characters. The test here is a Chinese character width,
Android: maxems // set the textview width to a maximum of n characters. Overwrite the EMS option when used with EMS.
Android: minems // set the textview width to the width of a minimum of n characters. Overwrite the EMS option when used with EMS.
Android: maxlength // restrict the length of the displayed text. The excess part is not displayed.
Android: lines // sets the number of lines of text. If you set two lines, two lines are displayed, even if the second row has no data.
Android: maxlines // sets the maximum number of lines displayed in the text, which is used in combination with width or layout_width. If the line exceeded is automatically wrapped, the line exceeded is not displayed.
Android: minlines // sets the minimum number of lines of text, similar to lines.
Android: linespacingextra // you can specify the row spacing.
Android: linespacingmultiplier // set a multiple of the line spacing. For example, "1.2"
Android: Numeric // If set, the textview has a digital input method. This is useless. The only effect after setting is that textview has a click effect. This attribute is described in detail in edtiview.
Android: Password // use a small dot "." To display text
Android: phonenumber // set it to the phone number input method.
Android: privateimeoptions // set the input method options, which is useless here and will be further discussed in edittext.
Android: scrollhorizontally // set whether to display a horizontal bar when the text exceeds the textview width.
Android: selectallonfocus // if the text is selectable, let him get the focus instead of moving the cursor to the start or end of the text. After being set in textview, there is no effect.
Android: shadowcolor // specifies the color of the text shadow, which must be used with shadowradius. Effect:
Android: shadowdx // sets the start position of the Shadow horizontal coordinate.
Android: shadowdy // set the start position of the Shadow vertical coordinate.
Android: shadowradius // set the shadow radius. If it is set to 0.1, it becomes the font color. Generally, it is better to set it to 3.0.
Android: singleline // sets the display of a single row. If it is used with layout_width, when the text cannot be fully displayed, "…" is used later. . For example, Android: text = "test _ singleline" Android: singleline = "true" Android: layout_width = "20dp" only displays "T ...". If singleline is not set or is set to false, the text will wrap automatically.
Android: shadowdx // sets the start position of the Shadow horizontal coordinate.
Android: shadowdy // set the start position of the Shadow vertical coordinate.
Android: shadowradius // set the shadow radius. If it is set to 0.1, it becomes the font color. Generally, it is better to set it to 3.0.
Android: singleline // sets the display of a single row. If it is used with layout_width, when the text cannot be fully displayed, "…" is used later. . For example, Android: text = "test _ singleline" Android: singleline = "true" Android: layout_width = "20dp" only displays "T ...". If singleline is not set or is set to false, the text will wrap automatically.
Android: Text // set to display text.
Android: textsize // set the text size. The recommended measurement unit is "SP", for example, "15sp"
Android: textstyle // you can specify one or more Font types in the [bold (BOLD) 0, italic (italic) 1, and bolditalic (bold and oblique) 2, separated by "|"
Android: Typeface // set the text font, which must be one of the following constant values: normal 0, sans 1, Serif 2, monospace (same width font) 3]
Android: height // sets the height of the text area. supported measurement units: Px (pixels)/DP/SP/In/mm (millimeters)
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. The unit of measurement is PX (pixel)/DP/SP/In/mm (mm). The difference from layout_width is shown here.
Android: maxwidth // set the maximum width of the text area
Android: minwidth // set the minimum width of the text area
Android: textappearance // set the text appearance. Such as "? Android: ATTR/textappearancelargeinverSe
"Here is a built-in system appearance ,? Indicates whether the system has this appearance. Otherwise, the default appearance is used. Configurable values: textappearancebutton/textappearanceinverse/textappearancelarge/textappearancelargeinverSE/textappearancemedium/textappearancemediuminveRSE/textappearancesmall/textappearancesmallinverSe
Android: textappearance // set the text appearance. Such as "? Android: ATTR/textappearancelargeinverSe
"Here is a built-in system appearance ,? Indicates whether the system has this appearance. Otherwise, the default appearance is used. Configurable values: textappearancebutton/textappearanceinverse/textappearancelarge/textappearancelargeinverSE/textappearancemedium/textappearancemediuminveRSE


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.