Макет координатора с RecyclerView

Я использую CoordinatorLayout с RecyclerView. Приложение работает нормально, но моя проблема в том, что представление должно прокручиваться только как элементы в RecyclerView. В моем случае у меня есть только 3 элемента, но CordinatorLayout будет прокручивать RecyclerView до тех пор, пока он не будет привязан к вершине из-за этого я получаю нижнюю часть белой, так как размер списка составляет всего 3.

XML

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <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:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.design.widget.AppBarLayout
            android:id="@+id/app_bar_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/transparent"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

            <android.support.design.widget.CollapsingToolbarLayout
                android:id="@+id/collapsing_toolbar_layout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"

                app:contentScrim="@android:color/transparent"
                app:layout_scrollFlags="scroll|exitUntilCollapsed">



                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignBottom="@+id/textView38"
                        android:layout_alignParentTop="true"
                        android:padding="20dp"
                        android:src="@drawable/ic_filter_back" />




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

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



        <android.support.v7.widget.RecyclerView
            android:id="@+id/rv_event_details"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clipToPadding="false"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />
    </android.support.design.widget.CoordinatorLayout>

    <LinearLayout
        android:id="@+id/linearLayout2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="#fff"
        android:orientation="horizontal"
        android:paddingBottom="03dp">

        <RelativeLayout
            android:id="@+id/rl_tab1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1">

            <ImageView
                android:id="@+id/tab1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:padding="05dp"
                android:src="@drawable/ic_create_wedding_admin" />

            <TextView
                android:id="@+id/tv_tab_1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/tab1"
                android:layout_marginLeft="05dp"
                android:layout_marginRight="05dp"
                android:gravity="center"
                android:text="Admin" />


        </RelativeLayout>


        <RelativeLayout
            android:id="@+id/rl_tab2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1">

            <ImageView
                android:id="@+id/tab2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:padding="05dp"
                android:src="@drawable/ic_create_wedding_guests" />

            <TextView
                android:id="@+id/tv_tab_2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/tab2"
                android:layout_marginLeft="05dp"
                android:layout_marginRight="05dp"
                android:gravity="center"
                android:text="Guests" />


        </RelativeLayout>


        <RelativeLayout
            android:id="@+id/rl_ed_tab_guests"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1">

            <ImageView
                android:id="@+id/iv_ed_iv_budget"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:padding="05dp"
                android:src="@drawable/ic_create_wedding_budget" />

            <TextView
                android:id="@+id/tvbud"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/iv_ed_iv_budget"
                android:layout_marginLeft="05dp"
                android:layout_marginRight="05dp"
                android:gravity="center"
                android:text="Budget" />


        </RelativeLayout>


        <RelativeLayout
            android:id="@+id/rl_ed_tab_tasks"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1">

            <ImageView
                android:id="@+id/iv_ed_iv_tasks"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:padding="05dp"
                android:src="@drawable/ic_create_wedding_tasks" />

            <TextView
                android:id="@+id/tv_ed_tasks"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/iv_ed_iv_tasks"
                android:layout_marginLeft="05dp"
                android:layout_marginRight="05dp"
                android:gravity="center"
                android:text="Tasks" />


        </RelativeLayout>


</LinearLayout>

What i want is to scroll the view only till the item size.


person Sonali Pawar    schedule 16.01.2016    source источник
comment
Возможный дубликат Android CoordinatorLayout + AppbarLayout + Viewpager всегда прокручивается   -  person Keshav    schedule 16.01.2016


Ответы (1)


Этот вопрос уже поднимался. Пожалуйста, проверьте другие вопросы, прежде чем публиковать другие.

Вам необходимо предоставить настраиваемое поведение для вашего дочернего макета в макете координатора.

Проверьте это, если это поможет:

https://stackoverflow.com/a/33461064/2346980

person Keshav    schedule 16.01.2016