我想在按鈕“0”和按鈕“1”之間洗掉。我的目標是它們之間的空間與按鈕“X”相同。

<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@ id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:insetBottom="0dp"
android:text="1" />
<Button
android:id="@ id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:insetBottom="0dp"
android:text="X" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@ id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:insetTop="0dp"
android:text="Button" />
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5" />
</TableRow>
</TableLayout>
uj5u.com熱心網友回復:
這是你可以做到的
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow>
<TableLayout
android:layout_width="0sp"
android:layout_height="match_parent"
android:layout_weight="1">
<TableRow
android:layout_width="0sp"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="0sp">
<com.google.android.material.button.MaterialButton
android:layout_width="0sp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="0" />
</TableRow>
<TableRow
android:layout_width="0sp"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="0sp">
<com.google.android.material.button.MaterialButton
android:layout_width="0sp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1" />
</TableRow>
</TableLayout>
<com.google.android.material.button.MaterialButton
android:layout_width="0sp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="X" />
</TableRow>
</TableLayout>
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/359591.html
標籤:安卓 xml 安卓布局 android-tablelayout
