我正在設計一個佈局,底部有3個按鈕,彼此相鄰。因爲我想在屏幕中間添加更多按鈕,所以我所做的是將整個屏幕設置爲相對佈局,並在底部獲得3個按鈕,然後添加線性佈局以包含這3個按鈕。但是,它卡住了。該按鈕在底部不顯示3個按鈕。這是我的XML佈局文件Android佈局:底部有3個按鈕
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:orientation="vertical"
android:weightSum="1">
<Button
android:id="@+id/button1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Button1"
android:layout_weight="0.3" />
<Button
android:id="@+id/button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Button2"
android:layout_weight="0.3"/>
<Button
android:id="@+id/button3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Button3"
android:layout_weight="0.3" />
</LinearLayout>
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/linearLayout1"
android:layout_marginTop="16dp"
android:layout_toRightOf="@+id/linearLayout1"
android:text="Button" />
<Button
android:id="@+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button4"
android:layout_alignParentRight="true"
android:layout_below="@+id/button4"
android:layout_marginTop="20dp"
android:text="Button" />
<Button
android:id="@+id/button6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/button5"
android:layout_marginTop="24dp"
android:text="Button" />
</RelativeLayout>