TextView属性小结
待改进
属性
-
android:autoLink
:Controls whether links such as urls and email addresses are automatically found and converted to clickable links.[enum]:定义文本中电话、email、url等的超级链接Values
- none:0x00
- web:0x01
- email:0x02
- phone:0x04
- map:0x08
- all:0x0f
Related Methods
- setAutoLinkMask(int)
-
android:autoText
:If set, specifies that this TextView has a textual input method and automatically corrects some common spelling errors. [boolean]:设置是否具有文本输入功能和文本的纠错功能Related Methods
- setKeyListener(KeyListener)
-
android:breakStrategy
:Break strategy (control over paragraph layout).[enum]Values
- simple:0,Line breaking uses simple strategy.
- high_quality1,Line breaking uses high-quality strategy, including hyphenation.
- balanced:2,Line breaking strategy balances line lengths.
Related Methods
- setBreakStrategy(int)
-
android:bufferType
:Determines the minimum type that getText() will return.[enum]默认normal
Values
- normal:0,Can return any CharSequence, possibly a Spanned one if the source text was Spanned.
- spannable:1,Can only return Spannable.
- editable:2,Can only return Spannable and Editable.
-
android:capitalize
:If set, specifies that this TextView has a textual input method and should automatically capitalize what the user types.[enum]默认none
:设置有文本输入控件的首字母大写功能Values
- none:0,
- sentences:1,
- words:2,
- characters:3,
-
android:cursorVisible
:Makes the cursor visible (the default) or invisible.[boolean]:设置光标是否显示,默认显示Related Methods
- setCursorVisible(boolean)
-
android:digits
:If set, specifies that this TextView has a numeric input method and that these specific characters are the ones that it will accept.[boolean]:是否只输入数字Related Methods
- setKeyListener(KeyListener)
-
android:drawableBottom
:The drawable to be drawn below the text.:绘制的东西在文本的下方Related Methods
- setCompoundDrawablesWithIntrinsicBounds(int,int,int,int)
android:drawableEnd/Left/Right/Start/Top
:-
android:drawablePadding
:The padding between the drawables and the text.[dimension]:设置图片和文本的间隙Related Methods
- setCompoundDrawablePadding(int)
-
android:drawableTint
:Tint to apply to the compound (left, top, etc.) drawables.Related Methods
- setCompoundDrawableTintList(ColorStateList)
-
android:drawableTintMode
:Blending mode used to apply the compound (left, top, etc.) drawables tint.[enum]Values
- src_over:3,
- src_in:5,
- src_atop:9,
- multiply:14,
- screen:15,
- add:16,
Related Methods
- setCompoundDrawableTintMode(PorterDuff.Mode)
android:editable
:If set, specifies that this TextView has an input method.[boolean]:设置文本控件的输入功能,TextView
默认是false
,EditView
默认是true
-
android:editorExtras
:Reference to an<input-extras>
XML resource containing additional data to supply to an input method, which is private to the implementation of the input method.Related Methods
- setInputExtras(int)
-
android:elegantTextHeight
:Elegant text height, especially for less compacted complex script text.[boolean]Related Methods
- setElegantTextHeight(boolean)
-
android:ellipsize
:If set, causes words that are longer than the view is wide to be ellipsized instead of broken in the middle.[enum]如果设置为true
文本的长度可以比控件的宽度长Vaules
- none:0,
- start:1,
- middle:2,
- end:3,
- marquee:4,
Related Methods
- setEllipsize(TextUtils.TruncateAt)
-
android:ems
:Makes the TextView be exactly this many ems wide.:控件文字的显示长度Related Methods
- setEms(int)
-
android:fontFamily
:Font family (named by string) for the text.设置文本的字体Related Methods
- setTypeface(Typeface)
-
android:fontFeatureSettings
:Font feature settings.设置字体的风格Related Methods
- setFontFeatureSettings(String)
-
android:freezesText
:If set, the text view will include its current complete text inside of its frozen icicle in addition to meta-data such as the current cursor position.[boolean]:设置保存文本的内容和光标的位置。Related Methods
- setFreezesText(boolean)
-
android:gravity
:Specifies how to align the text by the view's x- and/or y-axis when the text is smaller than the view.[enum]:设置控件中文本的位置Related Methods
- setGravity(int)
-
android:height
:Makes the TextView be exactly this many pixels tall.[dimension] :设置控件高度Related Methods
- setHeight(int)
-
android:hint
:Hint text to display when the text is empty.设置默认的显示文本Related Methods
- setHint(int)
-
android:hyphenationFrequency
:Frequency of automatic hyphenation.[enum]Frequency of automatic hyphenation.:自动断字的频率Values
- none:0,
- normal:1,Less frequent hyphenation, useful for informal use cases, such as chat messages.
- full:2,Standard amount of hyphenation, useful for running text and for screens with limited space for text.
Related Methods
- setHyphenationFrequency(int)
-
android:imeActionId
:Supply a value forEditorInfo.actionId
used when an input method is connected to the text view.[int] :设置IME动作ID,在onEditorAction
中捕获判断进行逻辑操作。Related Methods
- setImeActionLabel(CharSequence,int)
-
android:imeActionLabel
:Supply a value forEditorInfo.actionLabel
used when an input method is connected to the text view.:设置IME动作标签。Related Methods
- setImeActionLabel(CharSequence,int)
-
android:imeOptions
:Additional features you can enable in an IME associated with an editor to improve the integration with your application.Values
Related Methods
- setImeOptions(int)
-
android:includeFontPadding
:Leave enough room for ascenders and descenders instead of using the font ascent and descent strictly. [boolena] (Normally true).:设置文本是否要在顶部和底部的留空白RelatedFontPadding(boolean)
-
android:inputMethod
:If set, specifies that this TextView should use the specified input method (specified by fully-qualified class name).:设置输入的输入法(需要完限定名)Related Methods
- setKeyListener(KeyListener)
-
android:inputType
:The type of data being placed in a text field, used to help an input method decide how to let the user enter text.[enum] :设置文本的输入股类型Values
Related Methods
- setRawInputType(int)
-
android:letterSpacing
:Text letter-spacing.Related Methods
- setLetterSpacing(float)
-
android:lineSpacingExtra
:Extra spacing between lines of text.:行间距Related Methods
- setLineSpacing(float,float)
-
android:lineSpacingMultiplier
:Extra spacing between lines of text, as a multiplier.:设置行间距的倍数。Related Methods
- setLineSpacing(float,float)
-
android:lines
:Makes the TextView be exactly this many lines tall.:设置文本显示的行数Related Methods
- setLines(int)
-
android:linksClickable
:If set to false, keeps the movement method from being set to the link movement method even if autoLink causes links to be found.[boolean]:设置文本的链接是否能被点击Related Methods
- setLinksClickable(boolean)
-
android:marqueeRepeatLimit
:The number of times to repeat the marquee animation. Only applied if the TextView has marquee enabled.:跑马灯的次数Values
- marquee_forever
Related Methods
- setMarqueeRepeatLimit(int)
-
android:maxEms
:Makes the TextView be at most this many ems wide.:文本的最大显示字数Related Methods
- setMaxEms(int)
-
android:maxHeight
:Makes the TextView be at most this many pixels tall.:设置文本控件的最大高度Related Methods
- setMaxHeight(int)
-
android:maxLength
:Set an input filter to constrain the text length to the specified number.:设置一个文本过滤器,保证文本的最大长度。Related Methods
- setFilters(InputFilter)
-
android:maxLines
:Makes the TextView be at most this many lines tall.:设置文本的最大显示行数Related Methods
- setMaxLines(int)
-
android:maxWidth
:Makes the TextView be at most this many pixels wide.:设置文本的最大宽度Related Methods
- setMaxWidth(int)
-
android:minEms
:Makes the TextView be at least this many ems wide.:设置文本的最小字符长度Related Methods
- setMinEms(int)
-
android:minHeight
:Makes the TextView be at least this many pixels tall.设置文本的最小高度Related Methods
- setMinHeight(int)
android:minLines
android:minWidth
-
android:numeric
:If set, specifies that this TextView has a numeric input method. [boolean] 默认是false
:设置数字的输入法Values
- integer:0x01,Input is numeric.
- signed:0x03,Input is numeric, with sign allowed.
- decimal:0x05,Input is numeric, with decimals allowed.
Related Methods
- setKeyListener(KeyListener)
-
android:password
:Whether the characters of the field are displayed as password dots instead of themselves.[boolean] :设置文本是否以密码的显示输入Related Methods
- setTransformationMethod(TransformationMethod)
-
android:phoneNumber
:If set, specifies that this TextView has a phone number input method. The default is false.[boolean]:设置文本的输入方式为手机号码Related Methods
- setKeyListener(KeyListener)
-
android:privateImeOptions
:An addition content type description to supply to the input method attached to the text view, which is private to the implementation of the input method.Related Methods
- setPrivateImeOptions(String)
-
android:scrollHorizontally
:Whether the text is allowed to be wider than the view (and therefore can be scrolled horizontally).:Related Methods
- setHorizontallyScrglling(boolean)
-
android:selectAllOnFocus
:If the text is selectable, select it all when the view takes focus.[boolean]:如果文本被选中了,让全部文字都选中Related Methods
- setSelectAllOnFoucus(boolean)
-
android:shadowColor
:Place a blurred shadow of text underneath the text, drawn with the specified color. :设置文本控件的阴影颜色。Related Methods
- setShadowLayer(Float,float,float,int)
-
android:shadowDx
:Horizontal offset of the text shadow.:文本阴影的水平偏移量Related Methods
- setShadowLayer(float,float,float,int)
-
android:shadowDy
:Vertical offset of the text shadow.文本阴影的垂直偏移量Related Methods
- setShadowLayer(float,float,float,int)
-
android:shadowRadius
:Blur radius of the text shadow.:阴影的半径Related Methods
- setShadowLayer(float,float,float,int)
-
android:singleLine
:Constrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines, and advances focus instead of inserting a newline when you press the enter key.[boolean]:设置文本控件单行Related Methods
- setTransformationMethod(TransformationMethod)
-
android:text
:Text to display.Related Methods
- setText(CharSequence,TextVIew.BufferType)
-
android:textAllCaps
:Present the text in ALL CAPS. This may use a small-caps form when available.[boolean]:设置文本是否自动转换成大写Related Methods
- setAllCaps(boolean)
-
android:textAppearance
:Base text color, typeface, size, and style.:文本的参数Related Methods
- setTextAppearance(int)
-
android:textColor
:Text color.Related Methods
- setTextColor(int)
-
android:textColorHighlight
:Color of the text selection highlight.:高亮Related Methods
- setHighlightColor(int)
-
android:textColorHint
:Color of the hint text.Related Methods
- setHitTextColor(int)
-
android:textColorLink
:Text color for links.:设置文字链接的颜色Related Methods
- setLinkTextColor(int)
-
android:textIsSelectable
:Indicates that the content of a non-editable text can be selected.[boolean]:设置文本是否能被选中Related Methods
- isTextSelectable()
-
android:textScaleX
:Sets the horizontal scaling factor for the text.Related Methods
- setTextScaleX(float)
-
android:textSize
:Size of the text.Related Methods
- setTextSize(int,float)
-
android:textStyle
:Style (bold, italic, bolditalic) for the text.Values
- normal:0
- bold:1
- italic:2
Related Methods
- setTypeface(Typeface)
-
android:typeface
:Typeface (normal, sans, serif, monospace) for the text.Values
- normal
- sans
- serif
- monospace
Related Methods
- setTypeface(Typeface)
-
android:widthMakes
: the TextView be exactly this many pixels wide.Related Methods
- setWidth(int)