Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android布局笔记 #4

Open
huruji opened this issue Sep 2, 2017 · 0 comments
Open

Android布局笔记 #4

huruji opened this issue Sep 2, 2017 · 0 comments
Labels

Comments

@huruji
Copy link
Owner

huruji commented Sep 2, 2017

Android相对布局

相对布局可以让控件之间互相确定关系,保证屏幕的局部范围内几个控件之间的关系不受外部影响。
相对布局位置的属性有

属性值为true或false

android:layout_centerHorizontal 水平居中

android:layout_centerVertical 垂直居中

android:layout_centerInParent 相对于父元素完全居中

android:layout_alignParentBottom 贴紧父元素下边缘

android:layout_alignParentTop 贴紧父元素上边缘

android:layout_alignParentLeft 贴紧父元素左边缘

android:layout_alignParentRight 贴紧父元素右边缘

属性值为id引用

android:layout_below 在某元素下方

android:layout_above 在某元素上方

android:layout_toLeftOf 在某元素左边

android:layout_toRightOf 在某元素右边

android:layout_alignTop 元素上边缘与某元素的上边缘对齐

android:layout_alignBottom 元素下边缘与某元素的下边缘对齐

android:layout_alignRight 元素右边缘与某元素的右边缘对齐

android:layout_alignLeft 元素左边缘与某元素的左边缘对齐

属性值为具体的像素值

android:layout_marginBottom 离某元素下边缘的距离

android:layout_marginLeft 离某元素左边缘的距离

android:layout_marginRight 离某元素右边缘的距离

android:layout_marginTop 离某元素上边缘的距离

@huruji huruji added the Android label Sep 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant