The main.xml file code:
<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>
I have looked in the official android docs, from which I learned, android:layout_column means The index of the column in which this child should be. I’ve set the attribute on the two CheckBox: android:layout_column = "1", so I thought the two CheckBox should both in the second column(index: 1). but to my amazement, the first CheckBox is in the second column, and the second CheckBox is in the third column , just as you can see below:

Can anyone explain why?
You can’t put two
Viewsin the same column. The firstCheckBoxgoes in the column 1 as you set it withandroid:layout_column = "1"and the second CheckBox is automatically placed in the 2th column.Edit: If you do want your checkboxes in the same column you could just wrap them with a
LinearLayoutand then set theandroid:layout_column = "1"for thatLinearLayout.