新しいデザイン ライブラリを使用して Android アプリを開発しています。新しいGoogle フォト アプリで使用されているようなスクロール効果を作成したいと考えています。AppBarLayout を画面から完全にスクロールして、リサイクラー ビューがステータス バーの後ろにスクロールするようにしたいと思います。
アプリのテーマで windowTranslucentStatus を true に設定しました。メイン アクティビティの xml は次のとおりです。
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways" />
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
下にスクロールするとこんな感じ。
ツールバーが完全に消えるわけではありません。
手伝ってくれてありがとう!