API:file:///D:/Android/sdk/docs/reference/android/widget/TableLayout.html
layout文件:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">----------------------------------拉伸第一列已填满布局
<TableRow>
<TextView
android:text="@string/hello_world"
android:padding="3dip"
android:background="#aabbcc"
/>
<TextView
android:text="@string/hello_world"
android:padding="3dip"-------------------------------------设置上下左右padding
android:background="#bbaacc"
/>
<TextView
android:text="@string/hello_world"
android:padding="3dip"
android:background="#bbccaa"
/>
</TableRow>
<TableRow>
<TextView
android:text="@string/hello_world"
android:padding="3dip"
android:background="#aabbcc"
/>
<TextView
android:text="@string/hello_world"
android:padding="3dip"
android:background="#bbaacc"
/>
<TextView
android:text="@string/hello_world"
android:padding="3dip"
android:background="#bbccaa"
/>
</TableRow>
</TableLayout>
效果:
参考:TableLayout类