Android 相对布局
来源:互联网 发布:js单引号的转义字符 编辑:程序博客网 时间:2024/06/05 09:02
Android相对布局
android:layout_marginTop="25dip" //顶部距离
android:gravity="left" //空间布局位置
android:layout_marginLeft="15dip //距离左边距
// 相对于给定ID控件
android:layout_above 将该控件的底部置于给定ID的控件之上;
android:layout_below 将该控件的底部置于给定ID的控件之下;
android:layout_toLeftOf
android:layout_toRightOf
android:layout_alignBaseline
android:layout_alignTop
android:layout_alignBottom
android:layout_alignLeft
android:layout_alignRight
// 相对于父组件
android:layout_alignParentTop
android:layout_alignParentBottom如果为true,将该控件的底部与其父控件的底部对齐;
android:layout_alignParentLeft
android:layout_alignParentRight
// 居中
android:layout_centerHorizontal如果为true,将该控件的置于水平居中;
android:layout_centerVertical
android:layout_centerInParent
// 指定移动像素
android:layout_marginTop
android:layout_marginBottom 下偏移的值;
android:layout_marginLeft 左偏移的值;
android:layout_marginRight 右偏移的值;
android:id
下边是相对布局属性的说明:RelativeLayout
android:layout_below 将该控件的顶部至于给定ID的控件之下
android:layout_toLeftOf将该控件的右边缘和给定ID的控件左边缘对齐
android:layout_toRightOf将该控件的左边缘和给定ID的控件的右边缘对齐
android:layout_alignBaseline该控件的baseline和给定ID的控件的baseline对齐
android:layout_alignBottom将该控件的底部边缘与给定ID控件的底部边缘对齐
android:layout_alignLeft将该控件的左边缘与给定ID控件的左边缘对齐
android:layout_alignRight将该控件的右边缘与给定ID控件的右边缘对齐
android:layout_alignTop将该控件的顶部边缘与给定ID控件的顶部对齐
android:alignParentBottom如果该值为true,则将该控件的底部和父控件的底部对齐
android:layout_alignParentLeft如果该值为true,则将该控件左边与父控件的左边对齐
android:layout_alignParentRight如果该值为true,则将该控件的右边与父控件的右边对齐
android:layout_alignParentTop如果该值为true,则将该控件的顶部与父控件的顶部对齐
android:layout_centerHorizontal如果为真,该控件将被至于水平方向的中央
android:layout_centerInParent 如果为真,该控件将被至于父控件水平方向和垂直方向的中央
android:layout_centerVertical如果为真,该控件将被至于垂直方向的中央
TableLayout
<TableLayoutxmlns:android="http://schemas.android.com/apk/res/android"
android:stretchColumns="0"第一列作为拉伸列填满整行
EditText
android:scrollHorizontally
设置文本超出TextView的宽度的情况下,是否出现横拉条。
第一类:属性值为true或false