android TextView常用属性
16lz
2021-12-04
TextView是一个强大而基础的控件,掌握它的属性还是很有必要。
android:autoLink //将文本添加为链接形式,可以是网址、电话、邮箱等android:linksClickable //设置链接是否点击连接,即使设置了autoLink。android:textColorLink //文字链接的颜色.//根据TextView.BufferType在创建字符时,使用normal-SpannedString,spannable-SpannableString,editable-SpannableStringBuilderandroid:bufferType //在文字周围添加一个drawableandroid:drawableBottomandroid:drawableEndandroid:drawableLeftandroid:drawableRightandroid:drawableStart//文字与drawable间的距离android:drawablePadding//为drawable着色android:drawableTint//着色模式android:drawableTintModeandroid:editable //设置是否可编辑。对EditText有效//设置以“...”代替省略内容的位置,可以设置位置。android:ellipsize //在ellipsize指定marquee的情况下,设置重复滚动的次数,当设置为marquee_forever时表示无限次。android:marqueeRepeatLimitandroid:singleLine //设置单行//可能与系统语言有关,这里是一个汉字字符宽度//设置TextView的宽度,超过文本会换行。当 android:layout_width="match_parent" 时该属性不会生效android:emsandroid:fontFamily //设置字体android:gravity //文本在TextView中位置,文本需要比View小android:hint //text属性为空时,显示的默认文本android:textColorHint //设置提示信息文字的颜色,默认为灰色。与hint一起使用。android:includeFontPadding //设置文本是否包含顶部和底部额外空白,默认为true。android:letterSpacing //字母间距,float类型android:textScaleX //设置文字之间间隔,默认为1.0fandroid:lineSpacingExtra //行间距android:lineSpacingMultiplier设置行间距的倍数。如”1.2”android:lines //行数android:scrollHorizontally //设置文本超出TextView的宽度的情况下,是否出现横拉条。//设置阴影android:shadowColor android:shadowDx android:shadowDy android:shadowRadiusandroid:textAppearance //设置文字外观。android:textColor //文本颜色android:textColorHighlight //被选中文字的底色,默认为蓝色android:textIsSelectable //设置文本能否被选中 好像没用android:textStyle //粗体、斜体android:typeface //设置文本字体
append(CharSequence text) //追加文本,需要为BufferType.EDITABLE 模式
EditText:
//设置软键盘回车键的样式。 http://blog.csdn.net/shaoyezhangliwei/article/details/44805999android:imeOptions android:inputType //设置文本的类型android:selectAllOnFocus //选中时获得焦点
方法:
//文字改变监听addTextChangedListener(TextWatcher watcher)
View
android:alpha //透明度android:background //背景//关联方法: setDrawingCacheQuality(int) 属性说明: "设置绘图时半透明质量。有可以取以下3个值 auto——默认,由框架决定 high——高质量,使用较高的颜色深度,消耗更多的内存 low——低质量android:drawingCacheQuality android:layerType //设置软/硬加速
更多相关文章
- Delphi XE5 for Android(安卓)(十一)
- Android中改变Activity的不同icon:activity-alias
- 安卓文字过长,跑马灯文字滚动效果
- android Notification 的使用
- Android控件(TextView、EditView、ImageView、Button)
- Android(安卓)EditText常用属性功能汇总
- Android中保存并设置ListView位置
- Android设置透明、半透明等效果
- android:hintText与android:inputType详解