LordCommanDev
LordCommanDev

Reputation: 932

Toolbar overlap relative layout

I having a problem with my xml file. The toolbar is over the relative layout. I tried whit some properties like fitsSystemWindows and others but I cant fix it. Any idea abput which property could fix it?

This is my design

So, this is my xml file. I tried adding to the relavite layout the fitsSystemWindows property but doesnt work yet

<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>

Upvotes: 0

Views: 638

Answers (1)

Napster
Napster

Reputation: 1383

Just add app:layout_behavior="@string/appbar_scrolling_view_behavior" to your RelativeLayout. That should put that layout under the appbar

Upvotes: 2

Related Questions