<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fab="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|enterAlways">
<RelativeLayout
android:id="@+id/top_section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/header"
android:layout_marginTop="?actionBarSize"
android:background="@color/white"
app:layout_collapseMode="pin">
<ImageView
android:id="@+id/group_image"
android:layout_width="match_parent"
android:layout_height="200dp"
android:src="@drawable/ic_mysay_group_placeholder"
app:layout_scrollFlags="scroll|enterAlways" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/group_image"
android:background="#99000000"
android:paddingBottom="3dp">
<TextView
android:id="@+id/group_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="2dp"
android:text="Group name"
android:textColor="@color/white"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="@+id/visibility_rule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/group_title"
android:layout_marginBottom="2dp"
android:layout_marginStart="8dp"
android:layout_marginTop="3dp"
android:text="@string/public_group"
android:textColor="@color/white"
android:textSize="14sp" />
<ImageView
android:id="@+id/recent_questions"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginEnd="5dp"
android:layout_toStartOf="@+id/manage_contacts"
android:padding="5dp"
android:src="@drawable/ic_vote_white" />
<ImageView
android:id="@+id/manage_contacts"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/members_count_text_view"
android:padding="8dp"
android:src="@drawable/group_members_icon" />
<TextView
android:id="@+id/members_count_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:paddingEnd="10dp"
android:textColor="@color/white"
android:textSize="10sp" />
</RelativeLayout>
</RelativeLayout>
<com.mysayapplication.mysayapp.mysay.ui.MySayHeader
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<FrameLayout
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:background="@color/divider" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/divider"
android:layout_marginTop="8dp">
<RelativeLayout
android:id="@+id/closed_group_full_state"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp">
<TextView
android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="@string/tab_questions" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/label"
android:layout_marginTop="4dp">
<android.support.v7.widget.RecyclerView
android:id="@+id/archive_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:id="@+id/progress_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:visibility="gone">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="@+id/empty_questions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/no_questions_icon" />
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginBottom="10dp"
android:layout_marginEnd="24dp"
android:layout_marginStart="24dp"
android:layout_marginTop="10dp"
android:background="@color/toolbar_image_tint" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="24dp"
android:layout_marginStart="24dp"
android:gravity="center"
android:text="@string/answers_empty_state_msg"
android:textColor="@color/primary"
android:textSize="18sp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
</FrameLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom|end"
android:layout_marginBottom="10dp"
android:layout_marginEnd="10dp">
<com.github.clans.fab.FloatingActionButton
android:id="@+id/ask_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/fab_add"
fab:fab_colorNormal="@color/primary"
fab:fab_colorPressed="@color/primary_dark"
fab:fab_colorRipple="@android:color/transparent" />
</RelativeLayout>
![enter image description here](https://i.stack.imgur.com/vmBcQ.png)
Я не хочу, чтобы заголовок (@ + id / header) свернулся, когда я прокручиваю представление рециркулятора.
, если я размещу его вне CollapsingToolbarLayout, макет больше не будет разрушаться, а если я положу его вне AppBarLayout, он будет покрыт CollapsingToolbarLayout при прокрутке.
Моя цель - свернутьCollapsingToolbarLayout под заголовком таким образом, что заголовок всегда виден.