简体   繁体   English

工具栏重叠的相对布局

[英]Toolbar overlap relative layout

I having a problem with my xml file. 我的xml文件有问题。 The toolbar is over the relative layout. 工具栏位于相对布局上。 I tried whit some properties like fitsSystemWindows and others but I cant fix it. 我尝试了一些属性,例如fitsSystemWindows和其他属性,但无法修复。 Any idea abput which property could fix it? 任何想法都认为哪个属性可以解决?

这是我的设计

So, this is my xml file. 所以,这是我的xml文件。 I tried adding to the relavite layout the fitsSystemWindows property but doesnt work yet 我尝试将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>

Just add app:layout_behavior="@string/appbar_scrolling_view_behavior" to your RelativeLayout . 只需将app:layout_behavior="@string/appbar_scrolling_view_behavior"到您的RelativeLayout That should put that layout under the appbar 那应该将布局放在应用栏下方

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM