UI 开发

  • TableLayout 是使用表格的方式来排列控件的。
    既然是表格,就要有行和列,我们尽量会让每一行都有相同的行和列数,有些时候,会事以愿为,当表格的某行一定要有不相等的列数的时候,就需要合并单元格的方式来应对。
<TableLayout  android:layout_width="match_parent" android:layout_height="match_parent" android:stretchColumns="1">

        <TableRow>

            <TextView  android:id="@+id/a1" android:layout_height="wrap_content" />

            <EditText  android:id="@+id/edit" android:layout_height="wrap_content" />

        </TableRow>

        <TableRow>

            <Button  android:id="@+id/btn" android:layout_height="wrap_content" android:layout_span="2" />

        </TableRow>

    </TableLayout>
  • 列表内容
  • layout_span=”2”让Button占据两行的空间
  • stretchColumns=”1” 表示如果表格不能占满屏幕,就延伸第二列。指定为0就延伸第1列。

你可能感兴趣的:(android,布局)