title: how to gone toolbar menu when collapsed appBarLayout in android
body: <p>I want <strong>gone</strong> <code>toolbar</code> Menu when <strong>collapsed</strong> <code>appBarlayout</code>, but I don't know how can it.<br>
  <strong>My code is here:</strong></p>
  
  <pre><code>    public class MainFragment extends BaseFragment implements Toolbar.OnMenuItemClickListener ... 
  
          @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                   Bundle savedInstanceState) {
              View view = inflater.inflate(R.layout.fragment_main, container, false);
  
  ...
  }
      @Override
      public int getMenu() {
          return R.menu.search;
      }
  </code></pre>
  
  <p><strong>XML codes :</strong></p>
  
  <pre><code>&lt;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:fitsSystemWindows="true"
      tools:context="com.sepandar.xengine.fragment.MainFragment"&gt;
  
      &lt;android.support.design.widget.AppBarLayout
          android:id="@+id/appBar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="@android:color/transparent"
          android:fitsSystemWindows="true"
          android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
  
          &lt;android.support.design.widget.CollapsingToolbarLayout
              android:id="@+id/collapsingToolbar"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@android:color/transparent"
              android:fitsSystemWindows="true"
              app:contentScrim="?attr/colorPrimaryDark"
              app:expandedTitleMarginEnd="64dp"
              app:expandedTitleMarginStart="48dp"
              app:layout_scrollFlags="scroll|exitUntilCollapsed"&gt;
  
              &lt;com.sepandar.xengine.views.XTabLayout
                  android:id="@+id/xTab"
                  android:layout_width="match_parent"
                  android:layout_height="200dp"
                  app:layout_behavior="@string/appbar_scrolling_view_behavior"
                  app:tabMode="scrollable"/&gt;
  
              &lt;com.api.common.widget.MyToolbar
                  android:id="@+id/toolbar"
                  android:layout_width="match_parent"
                  android:layout_height="?attr/actionBarSize"
                  android:background="@android:color/transparent"
                  app:layout_collapseMode="pin"
                  app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                  app:theme="@style/ToolBarStyle"/&gt;
  
          &lt;/android.support.design.widget.CollapsingToolbarLayout&gt;
  
      &lt;/android.support.design.widget.AppBarLayout&gt;
  
      &lt;android.support.v4.view.ViewPager
          android:id="@+id/viewPager"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_below="@+id/xTab"
          app:layout_behavior="@string/appbar_scrolling_view_behavior"/&gt;
  
      &lt;com.nt.googleplaysearch.views.SearchView
          android:id="@+id/search"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:visibility="invisible"
          app:layout_collapseMode="pin"/&gt;
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>I want when Collapsed <strong>appBarLayout</strong>, <code>gone</code> <code>public int getMenu()</code>, and when expand show this <code>public int getMenu()</code>.</p>
  
  <p>How can I it?</p>