Код файла 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>
Iя посмотрел в официальных документах по Android, из которых я узнал, android:layout_column
означает Индекс столбца, в котором должен быть этот потомок. Я установил атрибут для двухCheckBox
: android:layout_column = "1"
, поэтому я подумал, что два CheckBox
должны оба во втором столбце (индекс: 1).но, к моему изумлению, первый CheckBox
находится во втором столбце, а второй CheckBox
- в третьем столбце, как вы можете видеть ниже: ![enter image description here](https://i.stack.imgur.com/bKPJT.png)
Может кто-нибудь объяснить, почему?