Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 为什么这个空白出现在appbar布局下面?_Android_Xml_Android Layout_Kotlin_Android Fragments - Fatal编程技术网

Android 为什么这个空白出现在appbar布局下面?

Android 为什么这个空白出现在appbar布局下面?,android,xml,android-layout,kotlin,android-fragments,Android,Xml,Android Layout,Kotlin,Android Fragments,我不知道是什么原因造成了这一空间。这一定是一些我不知道的xml文件。这是一个很好的片段: 这是安卓团队的一个bug。 除了希望他们把它修好,你什么也做不了。 除非你自己做。这是安卓团队的错误。 除了希望他们把它修好,你什么也做不了。 除非你自己做。如前所述,这是安卓方面的一个bug。解决方案是在线性布局内部使用相对布局,并为相对布局分配10的权重,以使其覆盖整个屏幕: <LinearLayout xmlns:android="http://schemas.android.c

我不知道是什么原因造成了这一空间。这一定是一些我不知道的xml文件。这是一个很好的片段:



这是安卓团队的一个bug。 除了希望他们把它修好,你什么也做不了。
除非你自己做。

这是安卓团队的错误。 除了希望他们把它修好,你什么也做不了。
除非你自己做。

如前所述,这是安卓方面的一个bug。解决方案是在线性布局内部使用相对布局,并为相对布局分配10的权重,以使其覆盖整个屏幕:

<LinearLayout 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:orientation="vertical"
    android:background="@android:color/holo_green_dark"
    android:weightSum="10">

    <RelativeLayout
        android:layout_weight="10"
        android:layout_width="match_parent"
        android:layout_height="0dp">
    </RelativeLayout>

</LinearLayout>

如前所述,这是安卓方面的一个bug。解决方案是在线性布局内部使用相对布局,并为相对布局分配10的权重,以使其覆盖整个屏幕:

<LinearLayout 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:orientation="vertical"
    android:background="@android:color/holo_green_dark"
    android:weightSum="10">

    <RelativeLayout
        android:layout_weight="10"
        android:layout_width="match_parent"
        android:layout_height="0dp">
    </RelativeLayout>

</LinearLayout>

当您添加到主活动资源文件:fitsSystemWindows=true时,该错误会出现。

当您添加到主活动资源文件:fitsSystemWindows=true时,该错误会出现

<LinearLayout 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:orientation="vertical"
    android:background="@android:color/holo_green_dark"
    android:weightSum="10">

    <RelativeLayout
        android:layout_weight="10"
        android:layout_width="match_parent"
        android:layout_height="0dp">
    </RelativeLayout>

</LinearLayout>