In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "what is the use of TextView attributes in Android". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Android:autoLink sets whether the text is displayed as a clickable link when the text is URL link / email/ phone number / map. Optional value (none/web / email/phone/map/all)
If android:autoText is set, the spelling correction of the input value is performed automatically. There is no effect here, it works when the input method is displayed and input.
Android:bufferType specifies the type of text to get in the getText () way. The option editable is similar to StringBuilder appendable characters, that is, after getText, you can call the append method to set the text content. Spannable can use styles in a given character range, as shown here 1 and 2.
Android:capitalize sets the uppercase type of English letters. There is no effect here, you need to pop up the input method to see it, see EditView this property description.
Android:cursorVisible sets the cursor to show / hide, which is displayed by default.
Android:digits sets which characters are allowed to be entered. For example, "1234567890% ()"
Android:drawableBottom outputs a drawable, such as an image, below the text. If you specify a color, the background of text is set to that color and overrides the latter when used with background.
Android:drawableLeft outputs a drawable, such as a picture, on the left side of text.
Android:drawablePadding sets the interval between text and drawable (picture). It can be used with drawableLeft, drawableRight, drawableTop and drawableBottom. It can be set to a negative number, but it has no effect when used alone.
Android:drawableRight outputs a drawable on the right side of text.
Android:drawableTop outputs a drawable directly above the text.
Whether the android:editable setting is editable.
Android:editorExtras sets the additional input data for the text.
Android:ellipsize sets how the control should be displayed when the text is too long. Such as the following value setting: "start" -? The ellipsis appears at the beginning; "end"-the ellipsis appears at the end; "middle"-the ellipsis appears in the middle; "marquee"-displays in the form of × × lights (the animation moves horizontally)
Android:freezesText sets the content of the saved text and the location of the cursor.
Android:gravity sets the text position. If set to "center", the text will be centered.
The text prompt message is displayed when android:hintText is blank, and the color of the prompt message can be set through textColorHint. This property is used in EditView, but it can also be used here.
Android:imeOptions additional function, set the lower right corner IME action and edit box-related actions, such as the lower right corner of actionDone will display a "done", but not set the default is an enter symbol. This is explained in more detail in EditView, but it is useless here.
Android:imeActionId sets the IME action ID.
Android:imeActionLabel sets the IME action tag.
Android:includeFontPadding sets whether the text contains extra white space at the top and bottom. The default is true.
Android:inputMethod specifies the input method for the text, which requires a fully qualified name (the full package name). For example: com.google.android.inputmethod.pinyin, but the error can not be found here.
Android:inputType sets the type of text to help the input method display the appropriate keyboard type. Explain in more detail in EditView, there is no effect here.
Android:linksClickable sets whether the link clicks on the link, even if autoLink is set.
Android:marqueeRepeatLimit sets the number of times to repeat scrolling when ellipsize specifies marquee. When set to marquee_forever, it means unlimited times.
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 width of up to N characters. Overrides the ems option when used with ems.
Android:minEms sets the width of the TextView to a width of at least N characters. Overrides the ems option when used with ems.
Android:maxLength limits the length of the text displayed, and the excess part is not displayed.
Android:lines sets the number of lines of text, and sets two lines to display two lines, even if the second line has no data.
Android:maxLines sets the maximum number of lines displayed for text, which is used in conjunction with width or layout_width. The excess automatically wraps, and the number of excess lines 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 the line spacing. Such as "1.2"
If android:numeric is set, the TextView has a digital input method. It is useless here. The only effect after setting is that TextView has a click effect. This attribute will be described in detail in EdtiView.
Android:password with smaller "." Display text
Android:phoneNumber is set to the way the phone number is entered.
Android:privateImeOptions sets input method options, which are useless here and will be discussed further in EditText.
Android:scrollHorizontally sets whether a horizontal bar appears when the text exceeds the width of the TextView.
Android:selectAllOnFocus if the text is optional, let it get focus instead of moving the cursor to the beginning or end of the text. There is no effect when it is set in TextView.
Android:shadowColor specifies the color of the text shadow and needs to be used with shadowRadius.
Android:shadowDx sets the starting position of the shadow horizontal coordinates.
Android:shadowDy sets the starting 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, generally set to 3.0 is better.
Android:singleLine sets a single-line display. If used with layout_width, when the text cannot be fully displayed, it is followed by "…" To show. Such as android:text= "test_ singleLine"
Android:singleLine= "true" android:layout_width= "20dp" will only show "t..." . If singleLine is not set or false is set, the text will automatically wrap
Android:text sets the display text.
Android:textAppearance sets the appearance of the text. For example, "? android:attr/textAppearanceLargeInverse" refers to an appearance that comes with the system. Indicates whether the system has this appearance, otherwise the default appearance is used. The following values can be set: textAppearanceButton/textAppearanceInverse/textAppearanceLarge/textAppearanceLargeInverse/textAppearanceMedium/textAppearanceMediumInverse/textAppearanceSmall/textAppearanceSmallInverse
Android:textColor sets text color
Background color of android:textColorHighlight selected text. Default is blue.
Android:textColorHint sets the color of the prompt text, which defaults to gray. Use with hint.
The color of the android:textColorLink text link.
Android:textScaleX sets the interval between text, which defaults to 1.0f.
Android:textSize sets the text size. It is recommended to measure "sp", such as "15sp".
Android:textStyle sets glyph [bold (bold) 0, italic (italic) 1, bolditalic (bold and oblique) 2] can be 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 units of measurement: 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 and supports the unit of measurement: px (pixels) / dp/sp/in/mm (millimeters). The difference with layout_width can be seen here.
Android:maxWidth sets the maximum width of the text area
Android:minWidth sets the minimum width of the text area
This is the end of the content of "what is the use of the TextView attribute in Android". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.