Android五大布局之RelativeLayout 示例代码
2012-12-25 12:49
435 查看
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/numberTV"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:text="@string/number" />
<EditText
android:id="@+id/numberET"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/numberTV"
android:inputType="phone" />
<TextView
android:id="@+id/contentTV"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_below="@id/numberET"
android:text="@string/content" />
<EditText
android:id="@+id/contentET"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/numberET"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/contentTV"
android:ems="10"
android:inputType="textMultiLine"
android:lines="3" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/contentET"
android:onClick="onClick"
android:text="@string/send" />
</RelativeLayout>
效果图:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/numberTV"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:text="@string/number" />
<EditText
android:id="@+id/numberET"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/numberTV"
android:inputType="phone" />
<TextView
android:id="@+id/contentTV"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_below="@id/numberET"
android:text="@string/content" />
<EditText
android:id="@+id/contentET"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/numberET"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/contentTV"
android:ems="10"
android:inputType="textMultiLine"
android:lines="3" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/contentET"
android:onClick="onClick"
android:text="@string/send" />
</RelativeLayout>
效果图:
相关文章推荐
- 在代码中设置RelativeLayout布局中标签的android:layout_toLeftOf、android:layout_toRightOf等属性
- android 使用代码实现 RelativeLayout布局
- Android常用的五大布局:LinearLayout/RelativeLayout/AbsoluteLayout/ TableLayout/FrameLayout
- 控件悬浮在某个控件之上 Android五大布局方式——相对布局(RelativeLayout)属性详解
- 浅谈Android五大布局(二)——RelativeLayout和TableLayout(配以小例子:代码+图)
- 浅谈Android五大布局(一)——LinearLayout、FrameLayout和AbsoulteLayout(配以小例子:代码+图)
- Android五大布局方式——相对布局(RelativeLayout)属性详解
- android五大布局之RelativeLayout(相对布局)
- 在代码中设置RelativeLayout布局中标签的android:layout_toLeftOf、android:layout_toRightOf等属性
- Android系统五大布局详解Layout
- Android相对布局(RelativeLayout)
- Android相对布局RelativeLayout各属性介绍
- 安卓第一行代码之百分比布局PercentFrameLayout/PercentRelativeLayout
- android代码里面写布局简单示例
- Android RelativeLayout布局之常用属性详解
- 浅谈Android五大布局(二)——RelativeLayout和TableLayout
- 浅谈Android五大布局(一)——LinearLayout、FrameLayout和AbsoulteLayout
- Android---->RelativeLayout相对对齐方式布局
- Android入门之相对布局(RelativeLayout)
- Android 五大布局(LinearLayout、FrameLayout、AbsoulteLayout、RelativeLayout、TableLayout )