Detailed explanation of TextView properties

Detailed explanation of TextView properties

  • android:singleLine sets single-line display.
  • android:lines    sets the number of lines of text. If two lines are set, two lines will be displayed, even if the second line has no data.
  • android:minLines sets the minimum number of lines of text, similar to lines.
  • android:maxLines sets the maximum number of displayed lines of text, and is used in conjunction with width or layout_width. The excess lines will be automatically wrapped, and the excess lines will not be displayed.
  • android:lineSpacingExtra sets line spacing.
  • android:lineSpacingMultiplier sets the multiple of line spacing. Such as "1.2"
  • android:numeric  If set, this TextView has a numeric input method. It is useless here. The only effect after setting is that the TextView has a click effect.
  • android:maxLength  limits the length of displayed text, and the excess portion will not be displayed.
  • android:ems  sets the width of TextView to the width of N characters. The test here is a Chinese character width
  • android:maxEms sets the width of TextView to a width of up to N characters. Overrides the ems option when used together with ems.
  • android:minEms sets the width of TextView to the shortest width of N characters. Overrides the ems option when used together with ems.
  • android:password  displays text (password box) with small dots "."
  • android:phoneNumber is set to the input method of phone number.
  • android:shadowColor specifies the color of the text shadow and needs to be used with shadowRadius .
  • android:shadowRadius sets the radius of the shadow. Setting it to 0.1 will change the font color. Generally, setting it to 3.0 will give better results.
  • android:shadowDx sets the starting position of the shadow horizontal coordinate.
  • android:shadowDy sets the starting position of the shadow's vertical coordinates.
  • android:autoLink   sets whether the text is displayed as a clickable link when the text is a URL link/email/phone number/map.
  • android:autoText   automatically performs spelling correction on input values.
  • android:bufferType   specifies the getText() text category (editable - call the append method to append characters, spannable can use styles in a given character area).
  • android:capitalize   sets the capitalization type of English letters.
  • android:cursorVisible   The cursor is shown/hidden and displayed by default.
  • android:visibility   control display/hide/invisible
  •  Which characters are allowed to be entered by android:digits . Such as "1234567890.+-*/% ()".
  • android:drawable( Top/Bottom/Left/Right  adds a drawable to text(top/bottom/left/right).
  • android:drawablePadding    text and drawable (picture) interval.
  • Whether android:editable   is editable.
  • ndroid:editorExtras   sets additional input data for text.
  • android:   When the ellipsize text is too long, the ellipsis is displayed (start-at the beginning)/(end-at the end)/(middle-in the middle)/(marquee-animation horizontal movement);
  • android:marqueeRepeatLimit sets the number of times to repeat scrolling when ellipsize specifies marquee. Marquee_forever   means unlimited times .
  • android:scrollHorizontally sets whether a horizontal bar appears when the text exceeds the width of the TextView.
  • android:freezesText  sets the content of the saved text and the position of the cursor.
  • android:gravity      text position.
  • android:hintText    text prompt information, the color of the prompt information can be set through textColorHint.

  • android:includeFontPadding   sets whether the text includes extra white 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).
  • android:inputType   sets the type of text to help the input method display the appropriate keyboard type. inputType input method type
  • android:linksClickable sets whether the link is clickable to connect, even if autoLink is set
  • android:textColor  sets text color 
  • android:textColorHighlight  The background color of the selected text, the default is blue
  • android:textColorHint  sets the color of the prompt information text. The default is gray. Used with hint.
  • android:textColorLink  The color of the text link.
  • android:textScaleX    sets the spacing between text, the default is 1.0f.
  • android:textSize    sets the text size, and the recommended measurement unit is "sp".
  • android:textStyle sets the font [bold (bold) 0, italic (italic) 1, bolditalic (bold and italic) 2] You can set one or more, separated by "|"
  • android:typeface font settings
  • 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, supporting measurement units: px (pixels)/dp/sp/in/mm (millimeters). See here for the difference with layout_width.
  • android:maxWidth sets the maximum width of the text area
  • android:minWidth sets the minimum width of the text area
  • android:selectAllOnFocus If the text is selectable, let it get focus instead of moving the cursor to the beginning or end of the text. There is no effect after setting it in TextView.
  • android:imeOptions    additional function, set the IME action in the lower right corner and the action related to the edit box. For example, actionDone will display a "Done" in the lower right corner. If not set, the default is a carriage return symbol.
  • android:imeActionId   sets the IME action ID.
  • android:imeActionLabel  sets the IME action label.

Guess you like

Origin blog.csdn.net/qq_28845393/article/details/90693043