title: CollapsingToolbarLayout: Change menu item icon color when it is expanded
body: <p>I'm using <strong><code>CollapsingToolbarLayout</code></strong> in my project.</p>
  
  <p>When the <strong><code>CollapsingToolbarLayout</code></strong> is expanded, By default it is white(i.e defined in <code>android:textColorSecondary</code> in <code>style.xml</code>).</p>
  
  <p><strong>My question:</strong> </p>
  
  <blockquote>
    <p>I want to change my menu item icon color.</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/g5E3n.png" rel="noreferrer"><img src="https://i.stack.imgur.com/g5E3n.png" alt="enter image description here"></a>
  here is my code:</p>
  
  <p>xml file:</p>
  
  <pre><code>&lt;android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:id="@+id/appbar_layout"
  android:layout_width="match_parent"
  android:layout_height="200dp"
  android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
  
  &lt;android.support.design.widget.CollapsingToolbarLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:contentScrim="?attr/colorPrimary"
      app:layout_scrollFlags="scroll|exitUntilCollapsed"
      app:titleEnabled="false"&gt;
  
      &lt;com.google.android.gms.maps.MapView
          android:id="@+id/mapView"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:scaleType="centerCrop"
          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:layout_collapseMode="pin" /&gt;
  
  &lt;/android.support.design.widget.CollapsingToolbarLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>MainActivity code:</p>
  
  <pre><code>    AppBarLayout appBarLayout = findViewById(R.id.appbar_layout);
  appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
              boolean isShow;
              int scrollRange = -1;
  
              @Override
              public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
                  if (scrollRange == -1) {
                      scrollRange = appBarLayout.getTotalScrollRange();
                  }
                  if (scrollRange + verticalOffset == 0) {
                      //collapse map
                      //TODO: change share icon color - set white share icon
                      isShow = true;
                  } else if (isShow) {
                      //expanded map
                      //TODO: change share icon color - set dark share icon
                      isShow = false;
                  }
                  }
              });
  </code></pre>
  
  <p>What i have tried so far:</p>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/32809602/how-to-change-toolbar-icons-color-on-collapsing">How to change toolbar icons color on collapsing</a></li>
  </ol>
  
  <p>set <code>toolbar.getNavigationIcon().setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);</code> but it changes back button color, while i want to change share button icon color.</p>
  
  <ol start="2">
  <li><a href="https://stackoverflow.com/questions/36020969/set-toolbar-icon-colour-programmatically">Set Toolbar Icon Colour Programmatically</a></li>
  </ol>
  
  <p><code>DrawableCompat.setTint</code> not work in my case.</p>
  
  <p>Thanks.</p>