title: CollapsingToolBarLayout, toolbar and menus
body: <p>I'm trying to get the menu on the toolbar for my app.</p>
  
  <p>Currently, I have a CollapsingToolbarLayout. When the user moves up the recyclerview, the image of an island reduces in size and then eventually it collapses into the toolbar.</p>
  
  <p>This is what it looks like when it is expanded:</p>
  
  <p><a href="https://i.stack.imgur.com/mpjJy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mpjJy.png" alt="collapsingtoolbarlayout"></a></p>
  
  <p>This is what it looks like when it has collapsed:</p>
  
  <p><a href="https://i.stack.imgur.com/xqEiT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xqEiT.png" alt="random island"></a></p>
  
  <p>Now, you can see that when it is expanded, the heart icon is duplicated (once in the FAB and once in the toolbar. I only want the heart icon to appear in the toolbar when the FAB is no longer visible otherwise, I feel that it will be confusing to a user when you have two buttons on the screen that does exactly the same thing.</p>
  
  <p>How can I only show the heart icon on the toolbar when the collapsingToolBarLayout is fully collapsed? I tried to look for some type of onCollapse listener but no luck.</p>
  
  <p>This is the code for the xml:</p>
  
  <pre><code>   &lt;android.support.design.widget.AppBarLayout
          android:layout_height="192dp"
          android:id="@+id/appbar"
          android:layout_width="match_parent"&gt;
  &lt;!--        android:fitsSystemWindows="true"--&gt;
          &lt;android.support.design.widget.CollapsingToolbarLayout
              android:id="@+id/collapsing_toolbar"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              app:layout_scrollFlags="scroll|exitUntilCollapsed"
  
              app:contentScrim="?attr/colorPrimary"
              app:expandedTitleMarginStart="16dp"
              app:expandedTitleMarginEnd="32dp"&gt;
  
              &lt;ImageView
                  android:id="@+id/backdrop"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:scaleType="centerCrop"
                  android:fitsSystemWindows="true"
                  android:src="@drawable/ocean395"
                  app:layout_collapseMode="pin" /&gt;
  
              &lt;android.support.v7.widget.Toolbar
                  android:id="@+id/toolbar"
                  android:minHeight="?attr/actionBarSize"
                  android:layout_width="match_parent"
                  android:layout_height="?attr/actionBarSize"
                  app:layout_collapseMode="pin"/&gt;
  
          &lt;/android.support.design.widget.CollapsingToolbarLayout&gt;
  
      &lt;/android.support.design.widget.AppBarLayout&gt;
  </code></pre>