<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/TableLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="*" > //拉伸每一列
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="250dp"
android:background="@android:color/holo_blue_bright"
android:textSize="30dp"
android:text="" />
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
<Button
android:id="@+id/btn01"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:text="C" />
<Button
android:id="@+id/btn02"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:text="←" />
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:text="%" />
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:text="÷" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:text="7" />
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:text="8" />
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:text="9" />
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:text="x" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:text="4" />
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:text="5" />
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:text="6" />
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:text="-" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:text="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:text="2" />
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:text="3" />
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:text="+" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:text="." />
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:text="0" />
<Button
android:id="@+id/btn19"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="30dp"
android:layout_span="2"
android:text="=" />
</TableRow>
</TableLayout>
效果展示: