RelativeLayout布局
来源:互联网 发布:js点击li添加样式 编辑:程序博客网 时间:2024/04/28 11:42
RelativeLayout布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <Button android:id="@+id/center" android:layout_width="150dp" android:layout_height="wrap_content" android:text="中间" android:textSize="32dp" android:layout_centerInParent="true"/> <!-- android:layout_alignLeft="@id/center" android:layout_alignRight="@id/center" 使用layout_alignLeft和layout_alignRight会拉伸控件使空间对齐 gravity对齐方式 --> <Button android:gravity="center" android:layout_alignLeft="@id/center" android:layout_alignRight="@id/center" android:layout_above="@id/center" android:layout_centerHorizontal="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="上面" android:textSize="32dp"/> <Button android:layout_alignLeft="@id/center" android:layout_alignRight="@id/center" android:layout_below="@id/center" android:layout_centerHorizontal="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="下面" android:textSize="32dp"/> <!-- 只要一边用了layout_toLeftOf,就可以使用android:layout_width="match_parent" --> <Button android:layout_toLeftOf="@id/center" android:layout_above="@id/center" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="左上" android:textSize="32dp"/> <Button android:layout_toLeftOf="@id/center" android:layout_below="@id/center" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="左下" android:textSize="32dp"/> <Button android:layout_toRightOf="@id/center" android:layout_above="@id/center" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="右上" android:textSize="32dp"/> <Button android:layout_toRightOf="@id/center" android:layout_below="@id/center" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="右下" android:textSize="32dp"/> <Button android:layout_alignTop="@id/center" android:layout_toLeftOf="@+id/center" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="左边" android:textSize="32dp"/> <Button android:layout_alignTop="@id/center" android:layout_toRightOf="@+id/center" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="右边" android:textSize="32dp"/></RelativeLayout>
0 0
- RelativeLayout布局
- RelativeLayout布局
- RelativeLayout布局
- RelativeLayout布局
- RelativeLayout布局
- RelativeLayout布局
- RelativeLayout 布局
- RelativeLayout布局
- RelativeLayout布局
- RelativeLayout布局
- RelativeLayout布局
- Android RelativeLayout布局详解
- Android布局之RelativeLayout
- 7.3 RelativeLayout布局详解
- android RelativeLayout布局属性
- RelativeLayout 相对布局
- Android布局之RelativeLayout
- RelativeLayout的布局
- stop用法
- CLRS 11.4开放寻址法
- java中的进制问题以及位运算
- php之smarty学习二
- 动画特效二十:仿支付宝转账动画
- RelativeLayout布局
- 大黄蜂(HORNET):比Tor更快更安全的匿名网络
- Mybatis3源码分析(07)-加载Configuration-总结
- iOS,Xcode7真机调试
- BZOJ1012最大数maxnumber
- 一个程序猿的奋斗史——大学入学
- 连接查询
- TableLayout
- BZOJ2186: [Sdoi2008]沙拉公主的困惑