title: Collapsing toolbar with floating action Menu
body: <p>I followed this link to create floating toolbar with fab ..</p>
  
  <p><a href="http://www.journaldev.com/13927/android-collapsingtoolbarlayout-example" rel="nofollow noreferrer">Collapsing toolbar with floating action Menu</a></p>
  
  <p>I tried to change the fab to a floating menu with few options when i click on the flab but when i attached the fab along with the toolbar,I couldn't collapse the toolbar along with the fab and hide the floating menu.</p>
  
  <p><a href="https://i.stack.imgur.com/WGeTM.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WGeTM.gif" alt="I need the fab to be a menu,When i click on it,It show show options downward and also it should collpase along with the toolbar"></a></p>
  
  <p>This is the link which i followed to create floating menu 
  <a href="https://ptyagicodecamp.github.io/creating-sub-menuitems-for-fab-floating-action-button.html" rel="nofollow noreferrer">Sub menu items in fab</a></p>
  
  <p>Can any one help me please....</p>
  
  <p>My layout</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;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:background="@color/bg_card"
      android:fitsSystemWindows="true"&gt;
  
      &lt;android.support.design.widget.AppBarLayout
          android:id="@+id/app_bar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:fitsSystemWindows="true"
          android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
  
          &lt;android.support.design.widget.CollapsingToolbarLayout
              android:id="@+id/collapsing_toolbar"
              android:layout_width="match_parent"
              android:layout_height="256dp"
              android:fitsSystemWindows="true"
              app:contentScrim="?attr/colorPrimary"
              app:layout_scrollFlags="scroll|exitUntilCollapsed"&gt;
  
              &lt;ImageView
                  android:id="@+id/header_image"
                  android:layout_width="match_parent"
                  android:layout_height="256dp"
                  android:fitsSystemWindows="true"
                  android:scaleType="centerCrop"
                  android:src="@drawable/app_bg_overlay"
                  app:layout_collapseMode="parallax" /&gt;
  
              &lt;android.support.v7.widget.Toolbar
                  android:id="@+id/toolbar"
                  android:layout_width="match_parent"
                  android:layout_height="?attr/actionBarSize"
                  app:elevation="4dp"
                  app:layout_collapseMode="pin"
                  app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /&gt;
  
          &lt;/android.support.design.widget.CollapsingToolbarLayout&gt;
  
          &lt;TextView
              android:id="@+id/textViewJob"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:background="@color/bg_card"
              android:maxLines="2"
              android:paddingBottom="8dp"
              android:paddingEnd="96dp"
              android:paddingStart="24dp"
              android:paddingTop="8dp"
              android:textColor="@color/white"
              android:textSize="16sp" /&gt;
  
          &lt;View
              android:layout_width="match_parent"
              android:layout_height="1dp"
              android:background="@color/black" /&gt;
  
          &lt;android.support.design.widget.TabLayout
              android:id="@+id/tabs"
              android:layout_width="match_parent"
              android:layout_height="?attr/actionBarSize"
              app:tabBackground="@color/bg_card"
              app:tabGravity="fill"
              app:tabIndicatorColor="@color/colorAccent"
              app:tabMode="fixed"
              app:tabSelectedTextColor="@color/white"
              app:tabTextColor="@color/hint_color" /&gt;
  
  
      &lt;/android.support.design.widget.AppBarLayout&gt;
  
      &lt;!--&lt;com.github.clans.fab.FloatingActionMenu
          app:layout_anchor="@id/collapsing_toolbar"
          app:layout_anchorGravity="bottom|right|end"&gt;--&gt;
      &lt;!--
  
          &lt;include layout="@layout/layout_fab" /&gt;--&gt;
  
  
      &lt;android.support.v4.view.ViewPager
          android:id="@+id/viewpager"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          app:layout_behavior="@string/appbar_scrolling_view_behavior" /&gt;
  
  
      &lt;FrameLayout
          android:id="@+id/fragment_container"
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
          &lt;FrameLayout
              android:id="@+id/fraToolFloat"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@android:color/transparent"
              android:orientation="vertical"
              app:layout_anchor="@id/app_bar"
              app:layout_anchorGravity="bottom|end"&gt;
  
              &lt;LinearLayout
                  android:id="@+id/linFab1"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="bottom|end"
                  android:layout_marginBottom="80dp"
                  android:layout_marginEnd="24dp"
                  android:layout_marginRight="8dp"
                  android:gravity="center_vertical"
                  android:orientation="horizontal"&gt;
  
                  &lt;android.support.v7.widget.CardView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      app:cardBackgroundColor="#FFF"
                      app:cardCornerRadius="4dp"
                      app:cardElevation="4dp"
                      app:cardUseCompatPadding="true"&gt;
  
                      &lt;TextView
                          android:id="@+id/lblMenu1"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:paddingBottom="2dp"
                          android:paddingLeft="6dp"
                          android:paddingRight="6dp"
                          android:paddingTop="2dp"
                          android:text="Mentorship"
                          android:textAppearance="?android:attr/textAppearanceSmall"
                          android:textStyle="bold" /&gt;
                  &lt;/android.support.v7.widget.CardView&gt;
  
                  &lt;android.support.design.widget.FloatingActionButton
                      android:id="@+id/fabSub1"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:src="@drawable/mentorship"
                      app:backgroundTint="@color/colorPrimaryDark"
                      app:fabSize="mini" /&gt;
  
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:id="@+id/linFab2"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="bottom|end"
                  android:layout_marginBottom="130dp"
                  android:layout_marginEnd="24dp"
                  android:layout_marginRight="8dp"
                  android:gravity="center_vertical"
                  android:orientation="horizontal"&gt;
  
                  &lt;android.support.v7.widget.CardView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      app:cardBackgroundColor="#FFF"
                      app:cardCornerRadius="4dp"
                      app:cardElevation="4dp"
                      app:cardUseCompatPadding="true"&gt;
  
                      &lt;TextView
                          android:id="@+id/lblMenu2"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:paddingBottom="2dp"
                          android:paddingLeft="6dp"
                          android:paddingRight="6dp"
                          android:paddingTop="2dp"
                          android:text="Alumni Meet"
                          android:textAppearance="?android:attr/textAppearanceSmall"
                          android:textStyle="bold" /&gt;
  
                  &lt;/android.support.v7.widget.CardView&gt;
  
                  &lt;android.support.design.widget.FloatingActionButton
                      android:id="@+id/fabSub2"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:src="@drawable/alumni"
                      app:backgroundTint="@color/colorPrimaryDark"
                      app:fabSize="mini" /&gt;
  
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:id="@+id/linFab3"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="bottom|end"
                  android:layout_marginBottom="180dp"
                  android:layout_marginEnd="24dp"
                  android:layout_marginRight="8dp"
                  android:gravity="center_vertical"
                  android:orientation="horizontal"&gt;
  
                  &lt;android.support.v7.widget.CardView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      app:cardBackgroundColor="#FFF"
                      app:cardCornerRadius="4dp"
                      app:cardElevation="4dp"
                      app:cardUseCompatPadding="true"&gt;
  
                      &lt;TextView
                          android:id="@+id/lblMenu3"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:paddingBottom="2dp"
                          android:paddingLeft="6dp"
                          android:paddingRight="6dp"
                          android:paddingTop="2dp"
                          android:text="Lunch Meetup"
                          android:textAppearance="?android:attr/textAppearanceSmall"
                          android:textStyle="bold" /&gt;
  
                  &lt;/android.support.v7.widget.CardView&gt;
  
                  &lt;android.support.design.widget.FloatingActionButton
                      android:id="@+id/fabSub3"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:src="@drawable/lunch"
                      app:backgroundTint="@color/colorPrimaryDark"
                      app:fabSize="mini" /&gt;
  
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:id="@+id/linFab4"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="bottom|end"
                  android:layout_marginBottom="230dp"
                  android:layout_marginEnd="24dp"
                  android:layout_marginRight="8dp"
                  android:gravity="center_vertical"
                  android:orientation="horizontal"&gt;
  
                  &lt;android.support.v7.widget.CardView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      app:cardBackgroundColor="#FFF"
                      app:cardCornerRadius="4dp"
                      app:cardElevation="4dp"
                      app:cardUseCompatPadding="true"&gt;
  
                      &lt;TextView
                          android:id="@+id/lblMenu4"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:paddingBottom="2dp"
                          android:paddingLeft="6dp"
                          android:paddingRight="6dp"
                          android:paddingTop="2dp"
                          android:text="Coffee Connect"
                          android:textAppearance="?android:attr/textAppearanceSmall"
                          android:textStyle="bold" /&gt;
  
                  &lt;/android.support.v7.widget.CardView&gt;
  
                  &lt;android.support.design.widget.FloatingActionButton
                      android:id="@+id/fabSub4"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:src="@drawable/lunch"
                      app:backgroundTint="@color/colorPrimaryDark"
                      app:fabSize="mini" /&gt;
  
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:id="@+id/linFabSetting"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="bottom|end"
                  android:layout_marginBottom="280dp"
                  android:gravity="center_vertical"
                  android:orientation="horizontal"&gt;
  
                  &lt;android.support.design.widget.FloatingActionButton
                      android:id="@+id/fabSetting"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_gravity="bottom|end"
                      android:layout_marginEnd="20dp"
                      android:src="@drawable/prof_plus"
                      app:backgroundTint="@color/colorPrimaryDark"
                      app:fabSize="normal" /&gt;
  
              &lt;/LinearLayout&gt;
  
          &lt;/FrameLayout&gt;
      &lt;/FrameLayout&gt;
  
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>My collapsing toolbar funtion</p>
  
  <p>private void setupCollapsingToolbar() {</p>
  
  <pre><code>collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
  headerImageView = (ImageView) findViewById(R.id.header_image);
  headerImageView.setImageBitmap(sqLiteDBHelper.getUserImage(Prefs.getUserKey()));
  collapsingToolbar.setTitleEnabled(true);
  collapsingToolbar.setTitle(sqLiteDBHelper.getName(Prefs.getUserKey()));
  collapsingToolbar.setCollapsedTitleTextAppearance(R.style.collapsedappbar);
  collapsingToolbar.setExpandedTitleTextAppearance(R.style.expandedappbar);
  
  subtitleTextView = (TextView) findViewById(R.id.textViewJob);
  appBarLayout = (AppBarLayout) findViewById(R.id.app_bar);
  appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
      int scrollRange = -1;
  
      @Override
      public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
          //Initialize the size of the scroll
          if (scrollRange == -1) {
              scrollRange = appBarLayout.getTotalScrollRange();
          }
  
          //Check if the view is collapsed
          if (scrollRange + verticalOffset == 0) {
              toolbar.setBackgroundColor(ContextCompat.getColor(ProfileActivity.this, R.color.colorPrimary));
              subtitleTextView.setVisibility(View.GONE);
              fraToolFloat.setVisibility(View.GONE);
          } else {
              toolbar.setBackgroundColor(ContextCompat.getColor(ProfileActivity.this, android.R.color.transparent));
              subtitleTextView.setText(sqLiteDBHelper.getCompanyName(Prefs.getUserKey()));
              subtitleTextView.setVisibility(View.VISIBLE);
              fraToolFloat.setVisibility(View.VISIBLE);
          }
  
      }
  });
  </code></pre>
  
  <p>}</p>
  
  <p>How to achieve this</p>
  
  <p><a href="https://i.stack.imgur.com/QWKfA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QWKfA.png" alt="enter image description here"></a></p>