Android,TextView的所有属性和方法
|
XML 属性 |
||
|
属性名称 |
相关方法 |
描述 |
|
android:autoLink |
setAutoLinkMask(int) |
设置是否当文本为URL链接/email/电话号码/map时,文本显示为可点击的链接。可选值(none/web/email/phone/map/all) |
|
android:autoText |
setKeyListener(KeyListener) |
如果设置,将自动执行输入值的拼写纠正。此处无效果,在显示输入法并输入的时候起作用。 |
|
android:bufferType |
setText(CharSequence,TextView.BufferType) |
指定getText()方式取得的文本类别。 |
|
android:capitalize |
setKeyListener(KeyListener) |
设置英文字母大写类型。 |
|
android:cursorVisible |
setCursorVisible(boolean) |
设定光标为显示/隐藏,默认显示。 |
|
android:digits |
setKeyListener(KeyListener) |
设置允许输入哪些字符。如“1234567890.+-*/%\n()” |
|
android:drawableBottom |
setCompoundDrawablesWithIntrinsicBounds(int,int,int,int) |
在text的下方输出一个drawable. |
|
android:drawableLeft |
setCompoundDrawablesWithIntrinsicBounds(int,int,int,int) |
在text的左边输出一个drawable,如图片。 |
|
android:drawablePadding |
setCompoundDrawablePadding(int) |
设置text与drawable(图片)的间隔,与drawableLeft、drawableRight、drawableTop、drawableBottom一起使用,可设置为负数,单独使用没有效果。 |
|
android:drawableRight |
setCompoundDrawablesWithIntrinsicBounds(int,int,int,int) |
在text的右边输出一个drawable,如图片。 |
|
android:drawableTop |
setCompoundDrawablesWithIntrinsicBounds(int,int,int,int) |
在text的正上方输出一个drawable,如图片。 |
|
android:editable |
设置是否可编辑。这里无效果,参见EditView。 |
|
|
android:editorExtras |
setInputExtras(int) |
设置文本的额外的输入数据。 |
|
android:ellipsize |
setEllipsize(TextUtils.TruncateAt) |
设置当文字过长时,该控件该如何显示。有如下值设置:”start”—–省略号显示在开头;”end”——省略号显示在结尾;”middle”—-省略号显示在中间;”marquee” ——以跑马灯的方式显示(动画横向移动) |
|
android:ems |
setEms(int) |
设置文本域的长度为 所定义的em |
|
android:freezesText |
setFreezesText(boolean) |
设置保存文本的内容以及光标的位置。 |
|
android:gravity |
setGravity(int) |
设置文本位置,如设置成“center”,文本将居中显示。 |
|
android:height |
setHeight(int) |
设置文本域的高度为所定义的值 |
|
android:hint |
setHint(int) |
Text为空时显示的文字提示信息,可通过textColorHint设置提示信息的颜色。 |
|
android:imeActionId |
setImeActionLabel(CharSequence,int) |
设置右下角EditorInfo.actionId与编辑框相关的动作。 |
|
android:imeActionLabel |
setImeActionLabel(CharSequence,int) |
设置IME动作标签 EditorInfo.actionLabel与编辑框相关的动作。 |
|
android:isScrollContainer |
附加功能,设置右下角IME动作与编辑框相关的动作. |
|
|
android:keepScreenOn |
setKeepScreenOn(boolean) |
设置文本是否包含顶部和底部额外空白,默认为true。 |
|
android:layerType |
setLayerType(int,Paint) |
为文本指定输入法,需要完全限定名(完整的包名)。 |
|
android:longClickable |
setLongClickable(boolean) |
设置文本的类型,用于帮助输入法显示合适的键盘类型。 |
|
android:minHeight |
设置行间距。 |
|
|
android:minWidth |
设置行间距的倍数。如”1.2” |
|
|
android:nextFocusDown |
setNextFocusDownId(int) |
Defines the next view to give focus to when the next focus is FOCUS_DOWN If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a RuntimeException will result when the reference is accessed. |
|
android:nextFocusForward |
setNextFocusForwardId(int) |
设置链接是否点击连接,即使设置了autoLink。 |
|
android:nextFocusLeft |
setNextFocusLeftId(int) |
在ellipsize指定marquee的情况下,设置重复滚动的次数,当设置为marquee_forever时表示无限次。 |
|
android:nextFocusRight |
setNextFocusRightId(int) |
设置TextView的宽度为最长为N个字符的宽度。 |
|
android:nextFocusUp |
setNextFocusUpId(int) |
设置TextView的宽度为最短为N个字符的宽度。 |
|
android:onClick |
设置文本区域的最大高度 |
|
|
android:padding |
setPadding(int,int,int,int) |
设置文本的最大显示行数,与width或者layout_width结合使用,超出部分自动换行,超出行数将不显示。 |
|
android:paddingBottom |
setPadding(int,int,int,int) |
设置文本区域的最大宽度 |
|
android:paddingLeft |
setPadding(int,int,int,int) |
Sets the padding, in pixels, of the left edge; seepadding. |
|
android:paddingRight |
setPadding(int,int,int,int) |
设置文本区域的最小高度 |
|
android:paddingTop |
setPadding(int,int,int,int) |
设置文本的最小行数. |
|
android:rotation |
setRotation(float) |
设置文本区域的最小宽度 |
|
android:rotationX |
setRotationX(float) |
如果被设置,该TextView有一个数字输入法。 |
|
android:rotationY |
setRotationY(float) |
以小点”.”显示文本 |
|
android:saveEnabled |
setSaveEnabled(boolean) |
设置为电话号码的输入方式。 |
|
android:scaleX |
setScaleX(float) |
设置输入法选项 |
|
android:scaleY |
setScaleY(float) |
设置文本超出TextView的宽度的情况下,是否出现横拉条。 |
|
android:scrollX |
如果文本是可选择的,让他获取焦点而不是将光标移动为文本的开始位置或者末尾位置。EditText中设置后无效果。 |
|
|
android:scrollY |
指定文本阴影的颜色,需要与shadowRadius一起使用。 |
|
|
android:scrollbarAlwaysDrawHorizontalTrack |
设置阴影横向坐标开始位置。 |
|
|
android:scrollbarAlwaysDrawVerticalTrack |
设置阴影纵向坐标开始位置。 |
|
|
android:scrollbarDefaultDelayBeforeFade |
设置阴影的半径。设置为0.1就变成字体的颜色了,一般设置为3.0的效果比较好。 |
|
|
android:scrollbarFadeDuration |
设置单行显示。如果和layout_width一起使用,当文本不能全部显示时,后面用“…”来表示。 |
|
|
android:scrollbarSize |
设置显示文本. |
|
|
android:scrollbarStyle |
设置文字外观。如颜色,字体等 |
|
|
android:scrollbarThumbHorizontal |
设置文本颜色 |
|
|
android:scrollbarThumbVertical |
被选中文字的底色,默认为蓝色 |
|
|
android:scrollbarTrackHorizontal |
设置提示信息文字的颜色,默认为灰色。与hint一起使用 |
|
|
android:scrollbarTrackVertical |
文字链接的颜色. |
|
|
android:scrollbars |
Defines which scrollbars should be displayed on scrolling or not. |
|
|
android:soundEffectsEnabled |
setSoundEffectsEnabled(boolean) |
设置文字之间间隔,默认为1.0f。 |
|
android:tag |
设置文字大小. |
|
|
android:transformPivotX |
setPivotX(float) |
设置字形[bold(粗体) 0, italic(斜体) 1, bolditalic(又粗又斜) 2] 可以设置一个或多个,用“|”隔开 |
|
android:transformPivotY |
setPivotY(float) |
设置文本字体,必须是以下常量值之一:normal 0, sans 1, serif 2, monospace(等宽字体) 3] |
|
android:translationX |
setTranslationX(float) |
translation in x of the view. |
|
android:translationY |
setTranslationY(float) |
translation in y of the view. |
|
android:visibility |
setVisibility(int) |
Controls the initial visibility of the view. |
Android,TextView的所有属性和方法的更多相关文章
- android TextView多行文本(超过3行)使用ellipsize属性无效问题的解决方法
这篇文章介绍了android TextView多行文本(超过3行)使用ellipsize属性无效问题的解决方法,有需要的朋友可以参考一下 布局文件中的TextView属性 复制代码代码如下: < ...
- 我的Android进阶之旅------> Android在TextView中显示图片方法
面试题:请说出Android SDK支持哪些方式显示富文本信息(不同颜色.大小.并包括图像的文本信息).并简要说明实现方法. 答案:Android SDK支持例如以下显示富文本信息的方式. 1.使用T ...
- 我的Android进阶之旅------> Android在TextView中显示图片方法
面试题:请说出Android SDK支持哪些方式显示富文本信息(不同颜色.大小.并包含图像的文本信息),并简要说明实现方法. 答案:Android SDK支持如下显示富文本信息的方式. 1.使用Tex ...
- Android TextView高级特性使用
TextView一般都是用来显示一段文本,这里说的高级特性主要是一些我们平常不太常用的属性.包括文字阴影.自定义字体.html嵌入多格式.字体加粗.插入图片.这些特性平时开发APP的时候,可能一般使用 ...
- Android TextView 添加下划线的几种方式
总结起来大概有5种做法: 1. 将要处理的文字写到一个资源文件,如string.xml(使用html用法格式化) 2. 当文字中出现URL.E-mail.电话号码等的时候,可以将TextView ...
- Android:TextView 自动滚动(跑马灯) (转)
Android:TextView 自动滚动(跑马灯) TextView实现文字滚动需要以下几个要点: 1.文字长度长于可显示范围:android:singleLine="true ...
- Android TextView 显示不全的自动补齐方式
TextView在Android开发中用到的地方应该是很多的.很多时候,TextView会有一行显示不全被截取或者会换行.之前我的解决办法比较笨拙,定死TextView的一行字数长度,最后一个以省略号 ...
- Android TextView背景颜色与背景图片设置
Android TextView 背景颜色与背景图片设置,android textview 控件,android textview 背景, android textview 图片,android te ...
- android TextView 添加下划线
android Textview加下划线 由于新做的一个项目要求有字体带下划线效果,当时看了下其实可以通过图片伪造出那种视觉效果.但是为了体现点技术含量,于是我想用Textview带下划线的效果.方法 ...
随机推荐
- Delphi 设计模式:《HeadFirst设计模式》Delphi7代码---工厂模式之简单工厂
简单工厂:工厂依据传进的参数创建相应的产品. http://www.cnblogs.com/DelphiDesignPatterns/archive/2009/07/24/1530536.html { ...
- BZOJ2120/洛谷P1903 [国家集训队] 数颜色 [带修改莫队]
BZOJ传送门:洛谷传送门 数颜色 题目描述 墨墨购买了一套N支彩色画笔(其中有些颜色可能相同),摆成一排,你需要回答墨墨的提问.墨墨会向你发布如下指令: 1. Q L R代表询问你从第L支画笔到第R ...
- Spring Cloud Feign 总结
Spring Cloud中, 服务又该如何调用 ? 各个服务以HTTP接口形式暴露 , 各个服务底层以HTTP Client的方式进行互相访问. SpringCloud开发中,Feign是最方便,最为 ...
- CSS排版常用值指南
高对比度是确保网页阅读无障碍的关键,但也往往会被过分强调. 白底黑子会让打断文本显得过分密集,反而影响可读性. 文字颜色 3b4348 链接颜色 235ea7 衬线字体 font-family: &q ...
- SQLSEVER 中的那些键和约束
SQL Server中有五种约束类型,分别是 PRIMARY KEY约束.FOREIGN KEY约束.UNIQUE约束.DEFAULT约束.和CHECK约束.查看或者创建约束都要使用到 Microso ...
- 安卓android破解方法
韩梦飞沙 yue31313 韩亚飞 han_meng_fei_sha 313134555@qq.com 如何给smali文件中的unicode字符串添加中文注释 如何注释掉smali文件中包含关键字 ...
- ARC 080 - C 4-adjacent
题面在这里! 把每个数替换成它在2上的指数,然后发现0只能和>=2的相邻,所以手玩一下就好啦. #include<bits/stdc++.h> #define ll long lon ...
- 【状压dp】Islands and Bridges
Islands and Bridges Time Limit: 4000MS Memory Limit: 65536K Total Submissions: 11034 Accepted: 2 ...
- 【动态规划】【线段树】 Codeforces Round #426 (Div. 1) B. The Bakery
给你一个序列,让你划分成K段,每段的价值是其内部权值的种类数,让你最大化所有段的价值之和. 裸dp f(i,j)=max{f(k,j-1)+w(k+1,i)}(0<=k<i) 先枚举j,然 ...
- Activity(活动)生命周期(2)--活动状态
每个活动在其生命周期中最多会有4种状态 一.运行状态 当一个活动位于返回栈的栈顶的时候,这时活动就处于运行状态.系统一般不会回收,因为这会带来非常差的用户体验 二.暂停状态 当一个活动不处于栈顶状态的 ...