RecyclerView gets behind / hidden from ToolBar / ActionBar

-1

Solution: link

Good evening guys, how are you? I have a problem and to be clear I took a print to show you:

Asyoucanseethelist(RecyclerView)isfallingbehindwhileitshouldbeundertheToolbar/Actionbar,IdonotknowwhatI'mdoingwrong,butIcouldnotsolvethisproblem,doesanyoneknowthesolution?I'mjustusingthesupportlibraryandnothingelse,theerroroccursbothintheemulatorandinAndroid4.1andin7also,bothrealdevices.Thistoolbarhideswhentheuserdescendsthescreen,inthecasewhenhepasseshisfingerdownfrombelow,butthat'snotaproblemIactuallysettoworklikethat.

IhaveresearchedinseveralwaysbutIhavenotachievedanythingrelatedtoit,therearealwaysresultsofotherproblemsorotherfeatures.

IfIfindthesolutionI'llpostithere...

FollowXML:

<?xmlversion="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    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:id="@+id/cl_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ListContatosActivity">

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/srl_swipe"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/rv_list"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
            android:scrollbars="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"/>
    </android.support.v4.widget.SwipeRefreshLayout>

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_height="wrap_content"
        android:background="@color/bg_cadastro"
        android:layout_width="match_parent">

        <android.support.v7.widget.Toolbar
            android:id="@+id/my_toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:minHeight="?attr/actionBarSize"
            app:layout_scrollFlags="scroll|enterAlways"/>
    </android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
    
asked by anonymous 11.03.2017 / 06:56

2 answers

1

Faced with our colleague's valuable help Natan Felipe I came up with the following solution, I searched for a substitute for layout_below in CoordinatorLayout that for my ignorance was already in my XML but in the wrong place through that solution I got the property app:layout_behavior="@string/appbar_scrolling_view_behavior" that was in my RecyclerView I removed the property from it and ready I put it in SwipeRefreshLayout and everything worked perfectly. Many thanks to all.

    
11.03.2017 / 13:32
1

Oops, are you using Relative layout as the parent view?

If you are using RelativeLayout as the parent view, you add the layout_below property in SwipeRefreshLayout.

<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/srl_swipe"
android:layout_below="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
    android:id="@+id/rv_list"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    android:scrollbars="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"/> 
</android.support.v4.widget.SwipeRefreshLayout>
    
11.03.2017 / 12:02