Android:如何更改将屏幕分成 3 个相等的按钮

fre*_*292 1 android screen button

我在布局中有 3 个按钮。我想要做的是增加按钮的大小,使它们填满整个屏幕。我怎样才能在 xml 文件中做到这一点?

mar*_*812 5

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:weightSum="3">

<Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="New Button"
    android:id="@+id/button"
    android:layout_weight="1"/>

<Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="New Button"
    android:id="@+id/button2"
    android:layout_weight="1"/>

<Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="New Button"
    android:id="@+id/button3"
    android:layout_weight="1"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

你需要 weightSum