0
在Android中可能会自动调整同一行上的botton宽度而不在布局文件中写入指定的宽度?如何自动适应Android中同一行上的bottons宽度?
我问这个问题,因为用AppInvetor它可能会自动适应bottons的宽度,这就是为什么我问你这个问题的原因。
在Android中可能会自动调整同一行上的botton宽度而不在布局文件中写入指定的宽度?如何自动适应Android中同一行上的bottons宽度?
我问这个问题,因为用AppInvetor它可能会自动适应bottons的宽度,这就是为什么我问你这个问题的原因。
您可以使用TableLayout来执行此操作。只需添加按钮TableRow
S和给他们match_parent宽度
的一种方式是一个表:
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow>
<Button />
<Button />
</TableRow>
<\TableLayout>
替代地,可以执行水平线性布局和分配权重给每个按钮为0的宽度。
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:layout_width="0dp"
android:layout_weight="1" />
<Button
android:layout_width="0dp"
android:layout_weight="1" />
<\LinearLayout>