RelativeLayout
相布局:可以设置位置,通过layout_marginLeft、layout_marginTop等
AbsoluteLayout
绝对布局:可以任意放置,通过layout_x 和layout_y
FrameLayout
帧布局:一层一层的悬浮在界面上,如暂停按钮
LinearLayout
线性布局:自上而下或自左向右,控件没有对齐设置
TableLayout
表格布局:一行一行的
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<!--
layout_weight:表示权重,权重一样大的平分屏幕宽度
gravity:文本局中
-->
<TextView
android:layout_weight="1"
android:gravity="center"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:text="哈哈"
/>
<TextView
android:layout_weight="1"
android:gravity="center"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:text="嘎嘎"
/>
</TableRow>
集合布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>