您的位置:首页 > 移动开发 > Android开发

Android TextView属性大全

2013-11-25 10:26 330 查看
android:ems 设置TextView的宽度为N个字符的宽度。

android:maxems 设置TextView的宽度为最长为N个字符的宽度。与ems同时使用时覆盖ems选项。

android:maxLength 限制输入字符数。如设置为5,那么仅可以输入5个汉字/数字/英文字母。

android:lines 设置文本的行数,设置两行就显示两行,即使第二行没有数据。

android:maxLines 设置文本的最大显示行数,与width或者layout_width结合使用,超出部分自动换行,超出行数将不显示。

android:minLines 设置文本的最小行数,与lines类似。

android:lineSpacingExtra 设置行间距。 android:lineSpacingMultiplier 设置行间距的倍数。如”1.2”

android:numeric 如果被设置,该TextView有一个数字输入法。有如下值设置:integer正整数、signed带符号整数、decimal带小数点浮点数。 android:password 以小点”.”显示文本 android:phoneNumber 设置为电话号码的输入方式。

android:singleLine 设置单行显示。如果和layout_width一起使用,当文本不能全部显示时,后面用“…”来表示。如android:text="test_      singleLine "

android:singleLine="true" android:layout_width="20dp"将只显示“t…”。如果不设置singleLine或者设置为false,文本将自动换行

android:textAppearance 设置文字外观。如“?android:attr/textAppearanceLargeInverse”这里引用的是系统自带的一个外观,?表示系统是否有这种外观,否则使用默认的外观。可设置的值如下:textAppearanceButton/textAppearanceInverse/textAppearanceLarge/textAppearanceLargeInverse/textAppearanceMedium/textAppearanceMediumInverse/textAppearanceSmall/textAppearanceSmallInverse android:textColor 设置文本颜色

android:textColorHighlight 被选中文字的底色,默认为蓝色 android:textColorHint 设置提示信息文字的颜色,默认为灰色。与hint一起使用。 android:textColorLink 文字链接的颜色.

android:textScaleX 设置文字之间间隔,默认为1.0f。参见TextView的截图。

android:textSize 设置文字大小,推荐度量单位”sp”,如”15sp”

android:textStyle 设置字形[bold(粗体) 0, italic(斜体) 1, bolditalic(又粗又斜) 2] 可以设置一个或多个,用“|”隔开

android:typeface 设置文本字体,必须是以下常量值之一:normal 0, sans 1, serif 2, monospace(等宽字体) 3]

android:height 设置文本区域的高度,支持度量单位:px(像素)/dp/sp/in/mm(毫米)

android:maxHeight 设置文本区域的最大高度

android:minHeight 设置文本区域的最小高度

android:width 设置文本区域的宽度,支持度量单位:px(像素)/dp/sp/in/mm(毫米),与layout_width的区别看这里。

android:maxWidth 设置文本区域的最大宽度

android:minWidth 设置文本区域的最小宽度
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: