工具栏重叠相对布局

Toolbar overlap relative layout

我的 xml 文件有问题。工具栏位于相对布局之上。我尝试了一些属性,如 fitsSystemWindows 和其他属性,但我无法修复它。有什么想法 属性 可以修复它吗?

所以,这是我的 xml 文件。我尝试将 fitsSystemWindows 属性 添加到 relavite 布局,但还没有工作

<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:fitsSystemWindows="false"
android:layout_height="match_parent">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fitsSystemWindows="true"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar_main"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        app:layout_collapseMode="pin">

    </android.support.v7.widget.Toolbar>

</android.support.design.widget.AppBarLayout>

<RelativeLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >

    <RelativeLayout
        android:id="@+id/layout_progress"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <ProgressBar
            android:id="@+id/progress_bar"
            android:layout_width="wrap_content"
            android:indeterminateOnly="true"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true" />
    </RelativeLayout>

    <com.theapplabperu.queestudiar.Utils.EmptyRecyclerView
        android:layout_width="match_parent"
        android:id="@+id/rv_universities"
        android:layout_height="match_parent"
        android:fillViewport="true"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

    <LinearLayout
        android:id="@+id/empty_main"
        android:visibility="gone"
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:layout_height="match_parent"
        android:layout_gravity="center">

        <LinearLayout
            android:layout_width="match_parent"
            android:gravity="center_vertical"
            android:layout_marginRight="24dp"
            android:layout_marginLeft="24dp"
            android:orientation="vertical"
            android:layout_height="match_parent">
            <ImageView
                android:src="@drawable/ic_intro_brain"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>
            <TextView
                android:id="@+id/txt_empty_title"
                android:layout_margin="12dp"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:textSize="24sp"
                android:textStyle="bold"
                android:text="Ups!"/>
            <TextView
                android:id="@+id/txt_empty_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:textSize="14sp"
                android:text="No hay resultados para mostrar."/>
        </LinearLayout>
    </LinearLayout>
</RelativeLayout>

只需将 app:layout_behavior="@string/appbar_scrolling_view_behavior" 添加到您的 RelativeLayout。那应该将该布局放在 appbar