EditText property description

EditText property description

android:layout_gravity="center_vertical"//Set the display position of the control: default top, centered here, and bottom

android:hint="Please enter the number!"//Set the prompt information displayed on the space

android:numeric="integer"//Settings can only enter integers, if it is a decimal: decimal

android:maxLength="8" //limit input length to 8

android:singleLine="true"//Set single-line input, once set to true, the text will not wrap automatically.

android:gray="top" //The pointer is in the first position of the first line in multiple lines et.setSelection(et.length());//Adjust the cursor to the last line

android:autoText //Automatic spelling help

android:capitalize //capitalize the first letter

android:digits //Settings only accept certain numbers

android:singleLine //Whether it is a single line or multiple lines, whether the carriage return leaves the text box or adds a new line to the text box

android:numeric // only accept numbers

android:password //password

android:phoneNumber // Enter phone number

android:editable //Whether it can be edited

android:autoLink="all" //Set the text hyperlink style when clicking on the URL, jump to the URL

android:password="true"//Set only password can be entered

android:textColor = "#ff8c00"//font color

android:textStyle="bold"//字体,bold, italic, bolditalic

android:textSize="20dip"//size

android:capitalize = "characters"//write in capital letters

android:textAlign="center"//EditText does not have this attribute, but TextView does

android:textColorHighlight="#cccccc"//The background color of the selected text, the default is blue

android:textColorHint="#ffff00"//Set the color of the prompt message text, the default is gray

android:textScaleX="1.5"//Control the spacing between words

android:typeface="monospace"//字型,normal, sans, serif, monospace

android:background="@null"//Space background, not here, refers to transparency

android:layout_weight="1"//The weight is very useful in controlling the size of the control display.

android:textAppearance="?android:attr/textAppearanceLargeInverse"//text appearance, here is an appearance that comes with the system,? Indicates whether the system has this appearance, otherwise use the default appearance.

TextView attribute name description

android:autoLink sets whether the text is displayed as a clickable link when the text is a URL link/email/phone number/map. Optional values ​​(none/web/email/phone/map/all)

android:autoText If set, will automatically perform spell correction of the input value. There is no effect here, it works when the input method is displayed and entered.

android:bufferType specifies the type of text obtained by getText(). The option editable is similar to StringBuilder that can append characters, that is to say, after getText, the append method can be called to set the text content. spannable can use styles in a given character area, see here 1, here 2.

android:capitalize sets the capitalization type of English letters. There is no effect here, you need to pop up the input method to see it, see the description of this property of EditView.

android:cursorVisible sets the cursor to show/hide, and it is displayed by default.

android:digits sets which characters are allowed to be entered. Such as "1234567890.+-*/% ()"

android:drawableBottom outputs a drawable below the text, such as a picture. If a color is specified, the background of the text will be set to that color, and the latter will be overwritten when used with the background.

android:drawableLeft outputs a drawable on the left side of the text, such as a picture.

android:drawablePadding sets the interval between text and drawable (picture), used together with drawableLeft, drawableRight, drawableTop, drawableBottom, can be set to a negative number, used alone has no effect.

android:drawableRight outputs a drawable on the right side of the text, such as a picture.

android:drawableTop outputs a drawable directly above the text, such as a picture.

The android:editable setting is editable. No effect here, see EditView.

android:editorExtras sets the extra input data of the text. Discuss again in EditView.

android:ellipsize sets how the control should be displayed when the text is too long. There are the following value settings: "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 (the animation moves horizontally )

android:freezesText sets the content of the saved text and the position of the cursor. See: here.

android:gravity sets the text position, if set to "center", the text will be displayed in the center.

The text prompt information displayed when android:hintText is empty, the color of the prompt information can be set through textColorHint. This property is used in EditView, but it can be used here as well.

The additional function of android:imeOptions is to set the IME action in the lower right corner and the action related to the edit box. For example, a "Done" will be displayed in the lower right corner of actionDone, and if it is not set, the default is a carriage return symbol. This is detailed in EditView and is useless here.

android:imeActionId sets the IME action ID. To explain in EditView, you can read this post first: here.

android:imeActionLabel sets the IME action label. Explain again in EditView.

android:includeFontPadding sets whether the text includes extra space at the top and bottom, the default is true.

android:inputMethod specifies the input method for text and requires a fully qualified name (complete package name). For example: com.google.android.inputmethod.pinyin, but the error cannot be found here.

android:inputType sets the type of text to help the input method display the appropriate keyboard type. Explain in detail in EditView, there is no effect here.

android:linksClickable sets whether the link is clicked to connect, even if autoLink is set.

android:marqueeRepeatLimit sets the number of repeated scrolling when ellipsize specifies marquee, and when set to marquee_forever, it means unlimited times.

android:ems sets the width of the TextView to the width of N characters. The test here is the width of a Chinese character character, as shown in the figure:

android:maxEms sets the width of the TextView to a width of up to N characters. Overrides the ems option when used with ems.

android:minEms sets the width of TextView to the shortest width of N characters. Overrides the ems option when used with ems.

android:maxLength limits the length of the displayed text, and the excess part is not displayed.

android:lines sets the number of lines of text. If two lines are set, two lines will be displayed, even if there is no data in the second line.

android:maxLines sets the maximum number of displayed lines of text, used in combination with width or layout_width, the excess part will wrap automatically, and the excess line 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"

android:numeric If set, the TextView has a numeric input method. It is useless here. The only effect after setting is that the TextView has a click effect. This property will be described in detail in EdtiView.

android:password displays text with dots "."

android:phoneNumber is set as the input method of phone number.

android:privateImeOptions sets the input method options, which is useless here and will be discussed further in EditText.

android:scrollHorizontally sets whether the horizontal bar appears when the text exceeds the width of the TextView.

android:selectAllOnFocus If the text is selectable, let him get the focus instead of moving the cursor to the beginning or end of the text. It has no effect after setting in TextView.

android:shadowColor specifies the color of the text shadow and needs to be used with shadowRadius. Effect:

android:shadowDx sets the starting position of the horizontal coordinates of the shadow.

android:shadowDy sets the starting position of the shadow vertical coordinates.

android:shadowRadius sets the radius of the shadow. If it is set to 0.1, it becomes the color of the font. Generally, it is better to set it to 3.0.

android:singleLine set single line display. If it is used together with layout_width, when the text cannot be fully displayed, it will be indicated by "...". Such as android:text="test_ singleLine " android:singleLine="true" android:layout_width="20dp" will only display "t...". If singleLine is not set or set to false, the text will automatically wrap

android:text sets the display text.

android:shadowDx sets the starting position of the horizontal coordinates of the shadow.

android:shadowDy sets the starting position of the shadow vertical coordinates.

android:shadowRadius sets the radius of the shadow. If it is set to 0.1, it becomes the color of the font. Generally, it is better to set it to 3.0.

android:singleLine set single line display. If it is used together with layout_width, when the text cannot be fully displayed, it will be indicated by "...". Such as android:text="test_ singleLine " android:singleLine="true" android:layout_width="20dp" will only display "t...". If singleLine is not set or set to false, the text will automatically wrap

android:text sets the display text.

android:textSize sets the text size, the recommended measurement unit is "sp", such as "15sp"

android:textStyle set font style [bold (bold) 0, italic (italic) 1, bolditalic (thick and oblique) 2] can set one or more, separated by "|"

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 sets the height of the text area, and supports measurement units: px (pixel)/dp/sp/in/mm (millimeter)

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, and supports measurement units: px (pixel)/dp/sp/in/mm (millimeter). The difference with layout_width is here.

android:maxWidth sets the maximum width of the text area

android:minWidth sets the minimum width of the text area

android:textAppearance sets the text appearance. For example, "?android:attr/textAppearanceLargeInverse" here refers to an appearance that comes with the system. ? Indicates whether the system has this appearance, otherwise the default appearance is used.

The values ​​that can be set are as follows:

textAppearanceButton/textAppearanceInverse/textAppearanceLarge/textAppearanceLargeInverse/textAppearanceMedium/textAppearanceMediumInverse/textAppearanceSmall/textAppearanceSmallInverse

android:textAppearance sets the text appearance. For example, "?android:attr/textAppearanceLargeInverse" here refers to an appearance that comes with the system. ? Indicates whether the system has this appearance, otherwise the default appearance is used.

The values ​​that can be set are as follows:

textAppearanceButton、textAppearanceInverse、textAppearanceLarge、

textAppearanceLargeInverse、textAppearanceMedium、textAppearanceMediumInverse


Guess you like

Origin blog.csdn.net/ydh7611/article/details/7866248