Android--(1)--TextView的常用属性值

TextView是文本控件,用来显示文本;
常用属性:
android:textIsSelectable=”true”     //设置让TextView文本可被选择
android:autoLink     //设置是否当文本为URL链接/email/电话号码/map时,文本显示为可点击的链接。可选值(none/web/email/phone/map/all);
android:drawableLeft    //在text的左边输出一个drawable,如图片。
android:drawablePadding    //设置text与drawable(图片)的间隔,与drawableLeft、 drawableRight、drawableTop、drawableBottom一起使用,可设置为负数,单独使用没有效果。
android:editable=”true”    //设置是否可编辑。
android:gravity    //设置文本位置,如设置成“center”,文本将居中显示。
android:includeFontPadding    //设置文本是否包含顶部和底部额外空白,默认为true。
android:maxLength    //限制显示的文本长度,超出部分不显示。
android:lineSpacingExtra    //设置行间距。
android:lineSpacingMultiplier    //设置行间距的倍数。如”1.2”
android:scrollHorizontally     //设置文本超出TextView的宽度的情况下,是否出现横拉条。
android:selectAllOnFocus    //如果文本是可选择的,让他获取焦点而不是将光标移动为文本的开始位置或者末尾位置。 TextView中设置后无效果,在EditText可查。
android:shadowColor 指定文本阴影的颜色,需要与shadowRadius一起使用。
android:shadowDx设置阴影横向座标开始位置。
android:shadowDy设置阴影纵向座标开始位置。
android:shadowRadius设置阴影的半径。设置为0.1就变成字体的颜色了,一般设置为3.0的效果比较好。
android:singleLine     设置单行显示。如果和layout_width一起使用,当文本不能全部显示时,后面用“…”来表示。如android:text=”test_ singleLine ”
android:singleLine=”true” android:layout_width=”20dp”将只显示“t…”。如果不设置singleLine或者设置为false,文本将自动换行
android:text设置显示文本.
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。
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   //设置文本区域的最小宽度

还有很多,不再一一列举(此为学习之用!!!)

推荐一个地址推荐博文

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章