回答編集履歴

1

コード追加

2023/05/31 11:21

投稿

jimbe
jimbe

スコア12659

test CHANGED
@@ -1 +1,41 @@
1
1
  まず、ボタンの LinearLayout は `android:layout_width="wrap_content"` なのでボタンの幅の合計になりますので、隙間は空きようがありません。
2
+
3
+
4
+ ```xml
5
+ <LinearLayout
6
+ android:layout_width="match_parent"
7
+ android:layout_height="wrap_content"
8
+ android:orientation="horizontal">
9
+ <Space
10
+ android:layout_width="0dp"
11
+ android:layout_height="0dp"
12
+ android:layout_weight="1" />
13
+ <Button
14
+ android:id="@+id/button4"
15
+ android:layout_width="wrap_content"
16
+ android:layout_height="wrap_content"
17
+ android:text="Button" />
18
+ <Space
19
+ android:layout_width="0dp"
20
+ android:layout_height="0dp"
21
+ android:layout_weight="1" />
22
+ <Button
23
+ android:id="@+id/button5"
24
+ android:layout_width="wrap_content"
25
+ android:layout_height="wrap_content"
26
+ android:text="Button" />
27
+ <Space
28
+ android:layout_width="0dp"
29
+ android:layout_height="0dp"
30
+ android:layout_weight="1" />
31
+ <Button
32
+ android:id="@+id/button6"
33
+ android:layout_width="wrap_content"
34
+ android:layout_height="wrap_content"
35
+ android:text="Button" />
36
+ <Space
37
+ android:layout_width="0dp"
38
+ android:layout_height="0dp"
39
+ android:layout_weight="1" />
40
+ </LinearLayout>
41
+ ```