如何制作网页视图和三个按钮?一个 xml 布局就够了吗?

How to make a web view and three buttons? Is a single xml Layout enough?

如何在 android 中制作网页视图和三个按钮,三个按钮彼此并排,网页视图出现在剩余屏幕上。

我试过下面的代码

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="fill_parent" tools:context=".MainActivity"
    android:orientation="vertical"
    >
    <WebView
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:id="@+id/webview"
android:background="#fff"
        />
   <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="100dp"
       android:orientation="horizontal"
       >
       <Button
           android:id="@+id/button1"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_weight="1"
           android:text="Button" />

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

   </LinearLayout>
</LinearLayout>

在此架构中创建布局

<Relative Layout>
     <LinearLayout 
           weight_sum =3 
           align_parent_bottom>
            <Button_1 
                 weight =1/>
            <Button_2 
                  weight =1/>
            <Button_3 
                  weight =1/>
      </Linear Layout>
     <WebView 
          above linearLayout 
          align_parent_top />
</Relative Layout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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" tools:context=".MainActivity"
    android:orientation="vertical"
    android:weightSum="5"
    >
    <WebView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:id="@+id/webview"
        android:background="#fff"
        android:layout_weight="4"
        />
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:orientation="horizontal"
        android:weightSum="3"
        android:layout_weight="1"
        >
        <Button
            android:id="@+id/button1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Button" />

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

        <Button
            android:id="@+id/button3"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Button" />

    </LinearLayout>
</LinearLayout>

这会完成你的工作