I used this tutorial to create a collapsing toolbar to create a layout similar to this:.
I want the book thumbnail to disappear when the whole toolbar is collapsed. But somehow, this is what's happening:
Here is my XML layout:
<?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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:fitsSystemWindows="true"
tools:context=".activities.GFSBookContentActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="@color/white"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="@+id/book_cover"
android:layout_width="match_parent"
android:layout_height="250dp"
app:layout_collapseMode="parallax"
android:scaleType="centerCrop" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_centerVertical="true"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay" >
<ImageView
android:id="@+id/back"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerVertical="true"
android:src="@drawable/ic_arrow_back"
android:textStyle="bold"
android:tint="@color/gfs_blue" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<!-- ..... -->
</android.support.v4.widget.NestedScrollView>
<ImageView
android:id="@+id/book_cover_thumb"
android:layout_width="150dp"
android:layout_height="200dp"
android:layout_gravity="center_horizontal"
android:scaleType="fitXY"
app:layout_anchor="@id/appbar"
app:layout_anchorGravity="bottom|center"
app:layout_collapseMode="parallax" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_height="50dp"
android:layout_width="50dp"
app:layout_anchor="@id/appbar"
app:layout_anchorGravity="bottom|right|end"/>
</android.support.design.widget.CoordinatorLayout>
I tried adding a FAB and it disappears. I want that behavior for my image thumbnail. Also, any idea on how to bring the thumbnail image down similar to the image I provided?