呃,它的意思是“这个孩子应该在的列的索引”。唯一棘手的部分是列从 0 开始。
例如:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">
<TableRow>
<TextView
android:text="URL:" />
<EditText android:id="@+id/entry"
android:layout_span="3"/>
</TableRow>
<TableRow>
<Button android:id="@+id/cancel"
android:layout_column="2"
android:text="Cancel" />
<Button android:id="@+id/ok"
android:text="OK" />
</TableRow>
</TableLayout>
上述布局中的两行都有四列。第一个有四列,因为它TextView
在第 0 列中有一个,一个EditText
跨越第 1、2 和 3 列。第二个有四列,因为它跳过第 0 列和第 1 列,并将两个Button
小部件放在第 2 列和第 3 列中,由第一个中的android:layout_column="2"
属性Button
。