Java 网络视图占据整个屏幕

Java 网络视图占据整个屏幕,java,xml,android-studio,android-layout,Java,Xml,Android Studio,Android Layout,我正试图在我的android Studio移动应用程序项目中的一个xml文件中实现WebView。我试图做的是有几个按钮,可以在应用程序本地的不同页面中导航,并且在这些按钮下面有一个网页。然而,webview一直占据着整个屏幕空间,我创建的按钮再也看不见了。以下是xml供参考 <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:androi

我正试图在我的android Studio移动应用程序项目中的一个xml文件中实现WebView。我试图做的是有几个按钮,可以在应用程序本地的不同页面中导航,并且在这些按钮下面有一个网页。然而,webview一直占据着整个屏幕空间,我创建的按钮再也看不见了。以下是xml供参考

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"


    android:background="#ffffff"
    tools:context=".GetInvolved" >

    <Button
        android:id="@+id/homeButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="51dp"
        android:adjustViewBounds="true"
        android:background="@android:color/black"
        android:clickable="false"
        android:onClick="goHome"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <WebView
        android:id="@+id/webView"
        android:layout_width="408dp"
        android:layout_height="572dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/homeButton" />

</androidx.constraintlayout.widget.ConstraintLayout>


我已经尝试了几个不同的堆栈溢出帖子,比如这篇,但是我无法让它工作。非常感谢您的帮助,谢谢

您可以在
Webview
标签中添加
app:layout\u constraintHorizontal\u bias
app:layout\u constraintvertic\u bias

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
     >

    <Button
        android:id="@+id/homeButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="51dp"
        android:adjustViewBounds="true"
        android:background="@android:color/black"
        android:clickable="false"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <WebView
        android:id="@+id/webView"
        android:layout_width="408dp"
        android:layout_height="572dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/homeButton"
        app:layout_constraintVertical_bias="0.037" />

</androidx.constraintlayout.widget.ConstraintLayout>

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
     >

    <Button
        android:id="@+id/homeButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="51dp"
        android:adjustViewBounds="true"
        android:background="@android:color/black"
        android:clickable="false"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <WebView
        android:id="@+id/webView"
        android:layout_width="408dp"
        android:layout_height="572dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/homeButton"
        app:layout_constraintVertical_bias="0.037" />

</androidx.constraintlayout.widget.ConstraintLayout>