D
D
dimasik1002002018-03-04 21:37:21
Java
dimasik100200, 2018-03-04 21:37:21

How to make the recycler view scroll not separately, but together with the element in front of it?

I have a fragment with 3 elements (toolbar, layout and recyclerview). It is necessary that the recyclerview, together with the layout in front of it, scrolls under the toolbar. How to do it?

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.asus.testapp147.HomeFragment">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <include layout="@layout/toolbar"/>

        <include layout="@layout/information_of_day" />

        <include layout="@layout/recycler_view"/>

    </LinearLayout>
    
</android.support.design.widget.CoordinatorLayout>

The blue arrow shows the required scrolling, and the red one shows what is now (the recycler view scrolls under the layout)
5a9c3cce8e323575755210.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2018-03-04
@dimasik100200

Obviously, push the layout into the recyclerview.

M
mitaichik, 2018-03-05
@mitaichik

You should use CoordinatorLayout + AppBar + different types of behavior. It makes no sense to describe everything here - here are a couple of articles https://habrahabr.ru/post/270121/ https://android.jlelse.eu/scrolling-behavior-for-a...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question