https://github.com/chrisbanes/cheesesquareと同様のデザインを実装しました
下にスクロールすると折りたたまれる画像を含む折りたたみ可能なツールバー
<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:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="@dimen/picture_heigth"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax">
</android.support.v4.view.ViewPager>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/scroll_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:foreground="?android:windowContentOverlay"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
LinearLayout
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
それはうまく機能しますが、常にではありません...たとえば、線形レイアウトの内部には、休憩要求が完了した後に埋められるビューがあります。これには、コンテンツを Viewpager の後ろにプッシュする効果があります。スクロールダウンして再度アップすると、すべてが再び正しい場所に移動します。
NestedSCrollVew に「fill_vertical」を設定することで、問題の一部が修正されていることをいくつかの SO スレッドで見ました。実際には、コンテンツは遅れませんが、scrollViewの下部がカットされています...下の余白を置くことで問題は解決しますが、それは動的であり、どの余白を置くべきかわかりません...