gpt4 book ai didi

android - 删除 TableLayout 列的空间

转载 作者:行者123 更新时间:2023-11-30 03:34:46 26 4
gpt4 key购买 nike

我通过 TableLayout 对齐 9 个复选框。我已通过 android:stretchColumns 对齐列,但列之间的空间很高。如何修复该空间。

<TableLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:stretchColumns="1" >

<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >

<CheckBox
android:id="@+id/cbRestaurant"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/drawer_select_restaurant"
android:textSize="14sp" />

<CheckBox
android:id="@+id/cbHotel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/drawer_select_hotel"
android:textSize="14sp" />

<CheckBox
android:id="@+id/cbNightLife"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/drawer_select_nightlife"
android:textSize="14sp" />
</TableRow>

<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >

<CheckBox
android:id="@+id/cbShopping"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/drawer_select_shopping"
android:textSize="14sp" />

<CheckBox
android:id="@+id/cbEmbrassies"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/drawer_select_embrassies"
android:textSize="14sp" />

<CheckBox
android:id="@+id/checkBox3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/drawer_select_attaction"
android:textSize="14sp" />
</TableRow>

<TableRow
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >

<CheckBox
android:id="@+id/cbShopping1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/drawer_select_hospital"
android:textSize="14sp" />

<CheckBox
android:id="@+id/cbEmbrassies1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/drawer_select_bank"
android:textSize="14sp" />

<CheckBox
android:id="@+id/checkBox4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/drawer_select_police"
android:textSize="14sp" />
</TableRow>
</TableLayout>

我现在的 table
enter image description here

我想要的结果
enter image description here

最佳答案

从每个 CheckBox 中删除 android:layout_weight="1" 并设置 android:layout_width="wrap_content"。这混淆了 TableRow。然后,设置 android:stretchColumns="*" 而不仅仅是 1。这会将可用宽度分配给所有列。

关于android - 删除 TableLayout 列的空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16782561/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com