
线性布局 LinearLayout:
<LinearLayout 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:orientation="vertical"
tools:context="com.example.top3.MainActivity" > <EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="请输入注册用户名"/>
<requestFocus />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="请输入密码"
/> <EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ems="5"
android:hint="请再次输入密码" > </EditText> <EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="请输入邮箱"/> <Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dip"
android:background="@drawable/btn_bg"
android:gravity="center"
android:hint="注册" /> </LinearLayout>
相对布局 RelativeLayout:
<?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"
> <EditText
android:id="@+id/e1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="请输入用户名"
/>
<EditText
android:id="@+id/e2"
android:layout_below="@id/e1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="请输入用户名" /> <Button
android:id="@+id/b2"
android:layout_below="@id/e2"
android:layout_alignRight="@id/e2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="注册"
/>
<Button
android:id="@+id/b1"
android:layout_below="@id/e2"
android:layout_toLeftOf="@id/b2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="登录"
/> </RelativeLayout>
帧布局FrameLyaout:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" > <TextView
android:id="@+id/t1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#f00"
android:height="300dp"
android:width="300dp" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#0f0"
android:height="100dp"
android:width="150dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00f"
android:height="50dp"
android:width="100dp" /> </FrameLayout>
表格布局TableLayout:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TableRow >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="name"
android:paddingLeft="20dp"
android:textSize="16dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="20dp"
android:textSize="16dp"
/> <TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="20dp"
android:textSize="16dp"
/>
</TableRow>
<TableRow>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="15dp"
android:textSize="8dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="40dp"
android:textSize="8dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="40dp"
android:textSize="8dp"
/>
</TableRow>
<TableRow>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="15dp"
android:textSize="8dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="40dp"
android:textSize="8dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="40dp"
android:textSize="8dp"
/>
</TableRow>
<TableRow>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="15dp"
android:textSize="8dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="40dp"
android:textSize="8dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="40dp"
android:textSize="8dp"
/>
</TableRow>
<TableRow>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="15dp"
android:textSize="8dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="40dp"
android:textSize="8dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="40dp"
android:textSize="8dp"
/>
</TableRow>
</TableLayout>