main.xml文件代码:
<TableRow
android:id="@+id/TableRow01"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:text="User"
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></TextView>
<EditText
android:text=""
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
></EditText>
<TextView
android:text="Test"
android:id="@+id/usernameTest"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
></TextView>
</TableRow>
<TableRow
android:id="@+id/TableRow05"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:text="Hobby"
android:id="@+id/hobby"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></TextView>
<CheckBox
android:text="A"
android:id="@+id/reading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
></CheckBox>
<CheckBox
android:text="B"
android:id="@+id/swimming"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
></CheckBox>
</TableRow>
我查看了官方的 android 文档,从中了解到,这android:layout_column
意味着这个孩子应该在的列的索引。我已经在两个CheckBox
: 上设置了属性android:layout_column = "1"
,所以我认为这两个CheckBox
应该都在第二列(索引:1)。但令我惊讶的是,第一个CheckBox
在第二列,第二个CheckBox
在第三列,如下所示:
谁能解释为什么?