Android--RelativeLayout相对布局
2015-03-20 20:27
357 查看
用到的属性主要是这几个layout_above、layout_below、layout_toLeftOf、layout_toRightOf.
一、下面来实现这个图的效果
二、代码如下:
一、下面来实现这个图的效果
二、代码如下:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button1" android:textSize="16dp" /> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button2" android:textSize="16dp" android:layout_toRightOf="@+id/button1" android:layout_below="@+id/button1"> </Button> <Button android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/button2" android:layout_toLeftOf="@+id/button2" android:text="button3" android:textSize="16dp" /> <Button android:id="@+id/button4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/button2" android:layout_toRightOf="@+id/button2" android:text="button4" android:textSize="16dp" /> <Button android:id="@+id/button5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/button2" android:layout_toRightOf="@+id/button2" android:text="button5" android:textSize="16dp" /> </RelativeLayout>
相关文章推荐
- Android学习-RelativeLayout相对布局属性方法
- Android界面布局二---------------RelativeLayout(相对布局)
- Android:控件布局(相对布局)RelativeLayout
- .Net程序猿玩转Android开发---(7)相对布局RelativeLayout
- .Net程序员玩转Android开发---(7)相对布局RelativeLayout
- Android 相对布局 RelativeLayout 属性
- Android中相对布局RelativeLayout各个属性的含义
- 浅谈android 的五大布局---LinearLayout(线性布局)、FrameLayout(单帧布局)、RelativeLayout(相对布局)、AbsoluteLayout(绝对布局)和Tab
- Android Layout 之 RelativeLayout,代码实现相对布局&android的button设置透明
- Android组件----RelativeLayout相对布局的属性详解
- Android 相对布局 RelativeLayout 属性
- Android Layout 之 RelativeLayout,代码实现相对布局
- 【Android开发学习25】界面布局之相对布局RelativeLayout
- Android界面布局-----RelativeLayout(相对布局)
- Android 相对布局 RelativeLayout 属性
- Android 相对布局 RelativeLayout 属性
- android 相对布局RelativeLayout
- Android 相对布局:RelativeLayout
- Android:控件布局(相对布局)RelativeLayout
- Android--五大布局(2)相对布局RelativeLayout