Android layout attributes Daquan

RelativeLayout

The first category: the attribute value is true or false
android :layout_centerHrizontal horizontally centered
android:layout_centerVertical center vertically
android:layout_centerInparent is completely centered relative to the parent element
android:layout_alignParentBottom snaps to the bottom edge of the parent element
android:layout_alignParentLeft snaps to the left edge of the parent element
android:layout_alignParentRight snaps to the right edge of the parent element
android:layout_alignParentTop snaps to the top edge of the parent element
android:layout_alignWithParentlfMissing
If the corresponding sibling element cannot be found, the parent element is used as the reference.
The second category: the attribute value must be the reference name of the id
android:layout_below is below an element
android:layout_above is above an element
android:layout_toLeftOf is on the left side of an element
Android :layout_toRightOf is on the right side of an element
android:layout_alignTop aligns the top edge of this element with the top edge of an element
android:layout_alignLeft aligns the left edge of this element with the left edge of an element
android:layout_alignBottom aligns the bottom edge of this element with the bottom edge of an element
android:layout_alignRight aligns the right edge of this element with the right edge of an element
The third category: the attribute value is a specific pixel on duty, such as 30dip
android:layout_marginBottom distance from the bottom edge of an element
Android: layout_marginLeft distance from the left edge of an element
Android: layout_marginRight distance from the right edge of an element
Android: the distance of layout_marginTop from the top edge of an element
android:hint sets the prompt information entered when the EditText is empty
android:gravity limits the content of the view: up, down, left and right
android:layout_gravity="right" is used to set the left to right of the Container (component)
The text displayed in the control specified by android:text should use the string in the string.xml file as much as possible
Android: textSize text size
Android: width control width
Android: height control height
Android: layout_width specifies the width of the Container component
Android: layout_height specifies the height of the Container component
View Proportionately divide the space
Android:Padding* padding
Android: when singleLine is true, the content is displayed on the same line
Android:scaleType: 控制图片如何resized/moved来匹配ImageViewsize
ImageView.ScaleType/android.scaleType 值的意义区别:
CENTER/center 按图片的原来size居中显示,当图片长宽超过View的长宽时,截取图片的居中部分显示
CENTER_CROP/centerCrop 按比例扩大图片的size居中显示,使得图片的长宽等于View的长宽
CENTER_INSIDE/centerinside 将图片的内容完整居中显示,通过缩小比例或原的size
使得图片长 宽等于或小于 View的长宽
FIT_CENTER/fitCenter 把图片按比例扩大/缩小到VIEW的宽度,居中显示
FIT_END/fitEnd 把图片按比例扩大/缩小到VIEW的宽度,居中在VIEW的下部位置
FIT_START/fitStart 把图片按比例扩大/缩小到VIEW的宽度,居中在VIEW的上部位置
FIT_XY/fitXY 把图片不按比例 扩大/缩小到VIEW的大小显示
MATRIX/matrix 用矩阵来绘制、动态缩小放大图片来显示。
Android:interpolator 控件动画进度(alpha scale translate rotate)
Android 提供了几个Interpolator子类,实现了不同的速度曲线,如下
accelerateDcelerateInterpolator 在动画开始与介绍的地方的速率比较慢,然后开始加速
CycleInterpolator 动画循环放特定的次数,速率改变沿着正弦曲线
DecelerateInterpolator 在动画开始的地方的速率改变比较慢,然后开始减速
LinearInterpolator 在动画的以均匀的速率改变
android:screenOrientation="portrait" 指定屏幕为竖屏
android:screenOrientation="landscape" 指定屏幕为横屏
Android:capitalize 设置英文字母大写类型
Android:cursorVisible 设置光标是否显示
Android:digits 设置允许输入哪些字符。如"123456&*"
Android:drawableBottom :在text的下方输出一个drawable。如果是颜色 设置为背景颜色
Android:drawableLeft :在text的左边输出一个drawable
Android:drawableRight :在text的右边输出一个drawable
Android:drawableTop :在text的顶部输出一个drawable
Android:editable 设置是否可编辑
Android:editorExtras 设置文本的额外的输入数据。
Android:ellipsize 设置当文字过长时,该控件如何显示,有如下属性
start 省略号显示在开头end省略号在结尾
middle 省略号在中间marquee以跑马灯的方式显示(动画横向移动)
Android:ems 设置TextView的宽度为N个字符的宽度
Android:freezesText 设置保存文本的内容以及光标内置
Android:includeFontPadding 设置文本是否包含顶部和底部额外空白,默认是true
Android:inputMethod 为文本指定输入法,需要完全限定名(完整的包名)
Android:inputType 设置广西的类型,用于帮助输入法显示合适的键盘类型
Android:lines 设置文本显示的行数
Android:lineSpacingExtra 设置行间距
Android:lineSpacingMultiplier 设置行间距的倍数。如1.3
Android:linksClickAble 设置链接是否点击连接,即使设置了autoLick
Android:marqueeRepeatLimit ellipsize指定的情况下,设置重复滚动次数。
当设置 marquee_forever为时表示无限次
Android:maxEms 设置TextView的宽度为最长为N个字符的宽度。与ems同时使用时覆盖ems选项
android:maxHeight 设置文本区域的最大高度 android:maxLength限制显示的文本长度,超出部分不显示。 android:maxLines设置文本的最大显示行数,与width或者layout_width结合使用,超出部分自动换行,超出行数将不显示。 android:maxWidth设置文本区域的最大宽度 android:minEms设置TextView的宽度为最短为N个字符的宽度。与ems同时使用时覆盖ems选项。 android:minHeight设置文本区域的最小高度 android:minLines设置文本的最小行数,与lines类似。 android:minWidth设置文本区域的最小宽度 android:numeric如果被设置,该TextView有一个数字输入法。
android:password 以小点”.”显示文本
android:phoneNumber 设置为电话号码的输入方式 android:privateImeOptions设置输入法选项 android:scrollHorizontally设置文本超出TextView的宽度的情况下,是否出现横拉条 android:selectAllOnFocus如果文本是可选择的,让他获取焦点而不是将光标移动为文本的开始位置或者末尾位置。TextView中设置后无效果。 android:shadowColor指定文本阴影的颜色,需要与shadowRadius一起使用 android:shadowDx设置阴影横向坐标开始位置。 android:shadowDy设置阴影纵向坐标开始位置。 android:shadowRadius设置阴影的半径。设置为0.1就变成字体的颜色了,一般设置为3.0的效果比较好。 android:singleLine设置单行显示。如果和layout_width一起使用,当文本不能全部显示时,后面用“…”来表示。如android:text="test_ singleLine "
adnroid:stretchColumns TableLayout里指定第几列作为拉伸(当填不满屏幕的时候) android:text设置显示文本. android:textSize设置文字大小,推荐度量单位”sp”或者"pt" android:textStyle设置字形[bold(粗体) 0, italic(斜体) 1, bolditalic(又粗又斜) 2]可以设置一个或多个,用“|”隔开 android:typeface设置文本字体,必须是以下常量值之一:normal 0, sans 1, serif 2, monospace(等宽字体) 3 android:width设置文本区域的宽度,支持度量单位:px(像素)/dp/sp/in/mm(毫米),与layout_width的区别看这里

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326487952&siteId=291194637