一,XML控件通用属性
1.android: id @+id/<控件ID>
标识控件ID,@表示后面的字符串是ID资源。
2.android: layout_width ( android:layout_height) wrap_content | fill+parent | match_parent
描述控件的宽(高)度,wrap_content表示填满父控件的空白,继承父控件的大小,fill_parent,match_parent表示大小刚好足够显示在当前父控件里在Android2.2中推荐match_parent代替fill_parent。
3.android: padding 数值
描述控件内容和控件边框的距离。
‘4.android: margin 数值
描述控件间的距离。
二, TextView使用属性
1.android: autoLink
设置文本为可点击的链接,可选值(none/web/email/phone/map/all)。
2.android: cursorVisible
设置光标是否可见,默认为显示。
3.android: ellipsize
设置当文字超出文本框长度时,控件如何显示文本,属性值有:start:省略号显示在开头;middle:省略号显示在中间;marquee:以跑马灯的方式显示(动画横向移动)。
4.android: gravity
设置文本对齐方式。
5.android: lines
设置文本行数。
6.android: maxLines(android:minLines)
设置文本的最大(小)显示行数,与width或layout_width结合使用。
7.android: linksClickable
设置链接是否可以点击。
8.android: lineSpacingExtra
设置行间距。
9.android: password
设置文笔以密码方式显示。
10.android: scrollHorizontally
设置文本超出文本框宽度时是否出现水平滚动条。
11.android: phoneNumber
设置文本只接受电话号码。
12.android: selectAllOnFocus
如果文本是可以选择的,是否让他获得焦点中的所有文本。
13.android: singleLine
设置单行显示,当文本不能完全显示时,超出部分用“...”代替。
14.android: height(android:width)
设置文本区域的高度(宽度),支持度量单位:px/dp/sp/in/mm。
15.android: maxWidth(android: maxWidth)
设置文本区域的最大(小)宽度。