Android5.0+ CollapsingToolbarLayout使用详解

  

  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"

  tools:context=".MainActivity">

  

  android:layout_width="match_parent"

  android:layout_height="256dp"

  android:fitsSystemWindows="true">

  

  android:id="@+id/collapsing_toolbar_layout"

  android:layout_width="match_parent"

  android:layout_height="match_parent"

  app:contentScrim="#30469b"

  app:expandedTitleMarginStart="48dp"

  app:layout_scrollFlags="scroll|exitUntilCollapsed">

  

  android:layout_width="match_parent"

  android:layout_height="match_parent"

  android:scaleType="centerCrop"

  android:src="@mipmap/bg"

  app:layout_collapseMode="parallax"

  app:layout_collapseParallaxMultiplier="0.7" />

  

  android:id="@+id/toolbar"

  android:layout_width="match_parent"

  android:layout_height="?attr/actionBarSize"

  app:layout_collapseMode="pin" />

  

  

  

  android:layout_width="match_parent"

  android:layout_height="match_parent"

  android:orientation="vertical"

  app:layout_behavior="@string/appbar_scrolling_view_behavior">

  

  android:id="@+id/recyclerView"

  android:layout_width="match_parent"

  android:layout_height="match_parent"

  android:scrollbars="none" />