新建android工程替换一下main.xml中的代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TableLayout android:id="@+id/TableLayout01"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:collapseColumns="4">
<TableRow android:id="@+id/TableRow01" android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView android:layout_width="wrap_content"
android:layout_weight="1" android:layout_height="wrap_content"
android:text="行1列1" android:background="@drawable/icon"/>
<ImageView android:layout_width="wrap_content"
android:layout_weight="1" android:layout_height="wrap_content"
android:text="行1列2" android:background="@drawable/icon"/>
<ImageView android:layout_width="wrap_content"
android:layout_weight="1" android:layout_height="wrap_content"
android:text="行1列3" android:background="@drawable/icon"/>
</TableRow>
<TableRow android:id="@+id/TableRow01" android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView android:layout_width="wrap_content"
android:layout_weight="1" android:layout_height="wrap_content"
android:text="行2列1" android:background="@drawable/icon"/>
<ImageView android:layout_width="wrap_content"
android:layout_weight="1" android:layout_height="wrap_content"
android:text="行2列2" android:background="@drawable/icon"/>
<ImageView android:layout_width="wrap_content"
android:layout_weight="1" android:layout_height="wrap_content"
android:text="行2列3" android:background="@drawable/icon"/>
</TableRow>
<TableRow android:id="@+id/TableRow01" android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView android:layout_width="wrap_content"
android:layout_weight="1" android:layout_height="wrap_content"
android:text="行3列1" android:background="@drawable/icon"/>
<ImageView android:layout_width="wrap_content"
android:layout_weight="1" android:layout_height="wrap_content"
android:text="行3列2" android:background="@drawable/icon"/>
<ImageView android:layout_width="wrap_content"
android:layout_weight="1" android:layout_height="wrap_content"
android:text="行3列3" android:background="@drawable/icon"/>
</TableRow>
</TableLayout>
</LinearLayout>