【Android 基础】EditText的属性介绍

简介:

EditText继承TextView,所以EditText具有TextView的属性特点,下面主要介绍一些EditText的特有的输入法的属性特点

android:layout_gravity="center_vertical"设置控件显示的位置:默认top,这里居中显示,还有bottom

android:hin Text为空时显示的文字提示信息,可通过textColorHint设置提示信息的颜色。
android:singleLine 设置单行输入,一旦设置为 true ,则文字不会自动换行。
android:gray="top"  多行中指针在第一行第一位置 et.setSelection(et.length()); :调整光标到最后一行
android:autoText  自动拼写帮助。这里单独设置是没有效果的,可能需要其他输入法辅助才行
android:capitalize  设置英文字母大写类型。设置如下值:sentences仅第一个字母大写;words每一个单词首字母大小,用空格区分单词;characters每一个英文字母都大写。
android:digits  设置允许输入哪些字符。如“1234567890.+-*/%\n()”
android:singleLine  是否单行或者多行,回车是离开文本框还是文本框增加新行 android:numeric  如果被设置,该TextView接收数字输入。有如下值设置:integer正整数、signed带符号整数、decimal带小数点浮点数。
android:inputType:设置文本的类型
android:password  密码,以小点”.”显示文本
android:phoneNumber  设置为电话号码的输入方式。
android:editable  设置是否可编辑。仍然可以获取光标,但是无法输入。
android:autoLink=”all”  设置文本超链接样式当点击网址时,跳向该网址
android:textColor = "#ff8c00" :字体颜色
android:textStyle="bold" :字体, bold, italic, bolditalic
android:textAlign="center" EditText 没有这个属性,但 TextView
android:textColorHighlight="#cccccc" :被选中文字的底色,默认为蓝色
android:textColorHint="#ffff00" :设置提示信息文字的颜色,默认为灰色
android:textScaleX="1.5" :控制字与字之间的间距
android:typeface="monospace" :字型, normal, sans, serif, monospace
android:background="@null" 空间背景,这里没有,指透明
android:layout_weight="1" :权重在控制控件显示的大小时蛮有用的。
android:textAppearance="?android:attr/textAppearanceLargeInverse" :文字外观,这里引用的是系统自带的一个外观,?表示系统是否有这种外观,否则使用默认的外观。





本文转自叶超Luka博客园博客,原文链接:http://www.cnblogs.com/yc-755909659/archive/2012/08/18/2645426.html,如需转载请自行联系原作者
目录
相关文章
|
4月前
|
XML Java Android开发
Android Studio App开发中改造已有的控件实战(包括自定义支付宝月份选择器、给翻页栏添加新属性、不滚动的列表视图 附源码)
Android Studio App开发中改造已有的控件实战(包括自定义支付宝月份选择器、给翻页栏添加新属性、不滚动的列表视图 附源码)
40 1
|
8月前
|
Android开发 UED
Android focusable属性的作用
Android focusable属性的作用
153 0
|
8月前
|
XML Android开发 数据格式
Android中利用shape属性自定义设置Button按钮
Android中利用shape属性自定义设置Button按钮
134 0
|
4月前
|
传感器 监控 物联网
Android Ble蓝牙App(三)特性和属性
Android Ble蓝牙App(三)特性和属性
|
8月前
|
Java Android开发
Android 中设置EditText输入框提示文本hint的字体大小
Android 中设置EditText输入框提示文本hint的字体大小
202 0
|
8月前
|
XML Java Android开发
Android 中通过Java代码动态生成EditText视图,并循环遍历EditText取出遍历的ID和文本框的值
Android 中通过Java代码动态生成EditText视图,并循环遍历EditText取出遍历的ID和文本框的值
102 0
|
8月前
|
Android开发
Android onActivityResult()的属性与用法
Android onActivityResult()的属性与用法
93 1
|
8月前
|
Android开发
Android ImageView scaleType 属性详细介绍与使用
Android ImageView scaleType 属性详细介绍与使用
91 0
|
8月前
|
XML Android开发 数据格式
Android Button 属性介绍与使用
Android Button 属性介绍与使用
229 0
|
8月前
|
Java Android开发 iOS开发
Android TextView 与 EditText 的区别与使用
Android TextView 与 EditText 的区别与使用
99 0