EditText的属性很多,这里介绍几个:android:hint="请输入数字!"//设置显示在空间上的提示信息
android:singleLine="true"//设置单行输入,一旦设置为true,则文字不会自动换行。
android:textColor="#ff8c00"//字体颜色
android:textSize="20dip"//大小
android:textAlign="center"//EditText没有这个属性,但TextView有,居中
android:textColorHint="#ffff00"//设置提示信息文字的颜色,默认为灰色android:textScaleX="1.5"//控制字与字之间的间距
android:background="@null"//背景,这里没有,指透明
android:textAppearance="?android:attr/textAppearanceLargeInverse"//文字外观
android:gray="top"//多行中指针在第一行第一位置

android:autoText//自动拼写帮助

android:digits//设置只接受某些数字

android:numeric//只接受数字

android:editable//是否可编辑

android:textAppearance="?android:attr/textAppearanceLargeInverse"//文字外观,这里引用的是系统自带的一个外观,?表示系统是否有这种外观,否则使用默认的外观。不知道这样理解对不对?


android:autoLink设置是否当文本为URL链接/email/电话号码/map时,文本显示为可点击的链接。可选值(none/web/email/phone/map/all)

android:bufferType指定getText()方式取得的文本类别。选项editable类似于StringBuilder可追加字符,

  也就是说getText后可调用append方法设置文本内容。spannable则可在给定的字符区域使用样式,参见这里1、这里2。

android:cursorVisible设定光标为显示/隐藏,默认显示。

android:drawableBottom在text的下方输出一个drawable,如图片。如果指定一个颜色的话会把text的背景设为该颜色,并且同时和background使用时覆盖后者。

android:drawablePadding设置text与drawable(图片)的间隔,与drawableLeft、drawableRight、drawableTop、drawableBottom一起使用,可设置为负数,单独使用没有效果。

android:drawableTop在text的正上方输出一个drawable,如图片。

android:editorExtras设置文本的额外的输入数据。在EditView再讨论。

android:freezesText设置保存文本的内容以及光标的位置。参见:这里。

android:hintText为空时显示的文字提示信息,可通过textColorHint设置提示信息的颜色。此属性在EditView中使用,但是这里也可以用。

android:imeActionId设置IME动作ID。在EditView再做说明,可以先看这篇帖子:这里。

android:includeFontPadding设置文本是否包含顶部和底部额外空白,默认为true。
android:inputType设置文本的类型,用于帮助输入法显示合适的键盘类型。在EditView中再详细说明,这里无效果。
android:marqueeRepeatLimit在ellipsize指定marquee的情况下,设置重复滚动的次数,当设置为marquee_forever时表示无限次。
android:maxEms设置TextView的宽度为最长为N个字符的宽度。与ems同时使用时覆盖ems选项。
android:maxLength限制显示的文本长度,超出部分不显示。
android:maxLines设置文本的最大显示行数,与width或者layout_width结合使用,超出部分自动换行,超出行数将不显示。
android:lineSpacingExtra设置行间距。
android:numeric如果被设置,该TextView有一个数字输入法。此处无用,设置后唯一效果是TextView有点击效果,此属性在EdtiView将详细说明。
android:phoneNumber设置为电话号码的输入方式。
android:scrollHorizontally设置文本超出TextView的宽度的情况下,是否出现横拉条。
android:shadowColor指定文本阴影的颜色,需要与shadowRadius一起使用。效果:

android:shadowDy设置阴影纵向坐标开始位置。

android:singleLine设置单行显示。如果和layout_width一起使用,当文本不能全部显示时,后面用“…”来表示。如android:text="test_singleLine"android:singleLine="true"android:layout_width="20dp"将只显示“t…”。如果不设置singleLine或者设置为false,文本将自动换行

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:textSize设置文字大小,推荐度量单位”sp”,如”15sp”

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

  android:typeface设置文本字体,必须是以下常量值之一:normal0,sans1,serif2,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设置文本区域的最小宽度

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

  android:textAppearance设置文字外观。如“?android:attr/textAppearanceLargeInverse

”这里引用的是系统自带的一个外观,?表示系统是否有这种外观,否则使用默认的外观。可设置的值如下:

textAppearanceButton/textAppearanceInverse/textAppearanceLarge/textAppearanceLargeInverse

EditText的属性很多,这里介绍几个:android:hint="请输入数字!"//设置显示在空间上的提示信息
android:singleLine="true"//设置单行输入,一旦设置为true,则文字不会自动换行。
android:textColor="#ff8c00"//字体颜色
android:textSize="20dip"//大小
android:textAlign="center"//EditText没有这个属性,但TextView有,居中
android:textColorHint="#ffff00"//设置提示信息文字的颜色,默认为灰色android:textScaleX="1.5"//控制字与字之间的间距
android:background="@null"//背景,这里没有,指透明
android:textAppearance="?android:attr/textAppearanceLargeInverse"//文字外观
android:gray="top"//多行中指针在第一行第一位置

android:autoText//自动拼写帮助

android:digits//设置只接受某些数字

android:numeric//只接受数字

android:editable//是否可编辑

android:textAppearance="?android:attr/textAppearanceLargeInverse"//文字外观,这里引用的是系统自带的一个外观,?表示系统是否有这种外观,否则使用默认的外观。不知道这样理解对不对?


android:autoLink设置是否当文本为URL链接/email/电话号码/map时,文本显示为可点击的链接。可选值(none/web/email/phone/map/all)

android:bufferType指定getText()方式取得的文本类别。选项editable类似于StringBuilder可追加字符,

  也就是说getText后可调用append方法设置文本内容。spannable则可在给定的字符区域使用样式,参见这里1、这里2。

android:cursorVisible设定光标为显示/隐藏,默认显示。

android:drawableBottom在text的下方输出一个drawable,如图片。如果指定一个颜色的话会把text的背景设为该颜色,并且同时和background使用时覆盖后者。

android:drawablePadding设置text与drawable(图片)的间隔,与drawableLeft、drawableRight、drawableTop、drawableBottom一起使用,可设置为负数,单独使用没有效果。

android:drawableTop在text的正上方输出一个drawable,如图片。

android:editorExtras设置文本的额外的输入数据。在EditView再讨论。

android:freezesText设置保存文本的内容以及光标的位置。参见:这里。

android:hintText为空时显示的文字提示信息,可通过textColorHint设置提示信息的颜色。此属性在EditView中使用,但是这里也可以用。

android:imeActionId设置IME动作ID。在EditView再做说明,可以先看这篇帖子:这里。

android:includeFontPadding设置文本是否包含顶部和底部额外空白,默认为true。
android:inputType设置文本的类型,用于帮助输入法显示合适的键盘类型。在EditView中再详细说明,这里无效果。
android:marqueeRepeatLimit在ellipsize指定marquee的情况下,设置重复滚动的次数,当设置为marquee_forever时表示无限次。
android:maxEms设置TextView的宽度为最长为N个字符的宽度。与ems同时使用时覆盖ems选项。
android:maxLength限制显示的文本长度,超出部分不显示。
android:maxLines设置文本的最大显示行数,与width或者layout_width结合使用,超出部分自动换行,超出行数将不显示。
android:lineSpacingExtra设置行间距。
android:numeric如果被设置,该TextView有一个数字输入法。此处无用,设置后唯一效果是TextView有点击效果,此属性在EdtiView将详细说明。
android:phoneNumber设置为电话号码的输入方式。
android:scrollHorizontally设置文本超出TextView的宽度的情况下,是否出现横拉条。
android:shadowColor指定文本阴影的颜色,需要与shadowRadius一起使用。效果:

android:shadowDy设置阴影纵向坐标开始位置。

android:singleLine设置单行显示。如果和layout_width一起使用,当文本不能全部显示时,后面用“…”来表示。如android:text="test_singleLine"android:singleLine="true"android:layout_width="20dp"将只显示“t…”。如果不设置singleLine或者设置为false,文本将自动换行

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:textSize设置文字大小,推荐度量单位”sp”,如”15sp”

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

  android:typeface设置文本字体,必须是以下常量值之一:normal0,sans1,serif2,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设置文本区域的最小宽度

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

  android:textAppearance设置文字外观。如“?android:attr/textAppearanceLargeInverse

”这里引用的是系统自带的一个外观,?表示系统是否有这种外观,否则使用默认的外观。可设置的值如下:

textAppearanceButton/textAppearanceInverse/textAppearanceLarge/textAppearanceLargeInverse

更多相关文章

  1. Android控件笔记——在界面中显示及输入文本信息
  2. 【android】两个按钮的宽度各占屏幕的一半
  3. android TextView 文本过长时用滚动条显示
  4. Android新增AppCompatTextView自适应字体大小和文本宽度
  5. Android之增强文本框(TextInputEditText)
  6. C#开发微信门户及应用(三)之文本消息和图文消息应答
  7. C# Facade外观模式中天河城购物出现的问题解决
  8. C#实现添加Word文本与图片超链接的方法
  9. 如何快速生成数据的文本路径呢?C++实现文本路径生成

随机推荐

  1. Android中的RectF类和PointF类
  2. 64位系统中安装Android(安卓)SDK“系统找
  3. android error统计
  4. android数据库(随apk一起发布数据库)
  5. android TextView 改变边框
  6. Android(安卓)ListView缓存惹得祸
  7. Android中使用Zxing集成、分析与优化
  8. 数据存储之Shared Preferences
  9. Android(安卓)ZXing 解析
  10. 在Android(安卓)Jar包使用图片资源的解决