hier ist, was ich tun möchte: Ich möchte eine Karte in einem CollapsingToolbarLayout anzeigen, unter der Karte sollte ein benutzerdefiniertes Layout sein, das ein paar Steuerelemente enthält. Darunter ist ein RecyclerView. Ich möchte in der Lage sein, sowohl das benutzerdefinierte Layout als auch den RecyclerView zu scrollen, aber das benutzerdefinierte Layout oben zu fixieren, während der RecyclerView weiter scrollt. Hier ist ein Bild von dem, was ich erreichen will (grau = map; rot = benutzerdefiniertes Layout, grün = RecyclerView): CollapsingToolbarLayout: Fixes benutzerdefiniertes Layout oben
Hier ist, was ich bisher haben. Es funktioniert gut, außer dass das benutzerdefinierte Layout (rot) nicht aufhört zu scrollen, wenn es den oberen Bildschirmrand erreicht.
<?xml version="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:mapbox="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="400dp"
android:orientation="vertical"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsingToolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<com.mapbox.mapboxsdk.maps.MapView
android:id="@+id/map_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_collapseMode="parallax"
mapbox:zoom="12"
mapbox:style_url="@string/style_light"
mapbox:access_token="@string/access_token">
</com.mapbox.mapboxsdk.maps.MapView>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<include layout="@layout/current_activity"></include>
<android.support.v7.widget.RecyclerView
android:id="@+id/activity_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
Was ist der einfachste Weg, um dieses Verhalten zu erreichen?