title: Bottom Navigation changing selected icon color
body: <p>I am trying to make a custom bottom navigation in android. 
  I wanted to disable the shift and to given custom colors for icons.
  The icons are initially grey color and the selected one turns blue.
  The problem is that all images stay grey even if they are selected. </p>
  
  <p>I tried to mess with some of it but nothing is making the buttons change color when selected.</p>
  
  <p>Below is the code I tried.</p>
  
  <p>This is the main activity java</p>
  
  <pre><code>public class admin extends AppCompatActivity {
  
  
  BottomNavigationView bottomNavigationView;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_admin);
  
      bottomNavigationView = (BottomNavigationView) findViewById(R.id.navigation);
      BottomNavigationViewHelper.disableShiftMode((bottomNavigationView));
      bottomNavigationView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
      bottomNavigationView.setItemIconTintList(null);
  
      urgent urgentfragment = urgent.newInstance();
      setFragment(urgentfragment,false);
  
  }
  
  
  
  private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
          = new BottomNavigationView.OnNavigationItemSelectedListener() {
  
      @Override
      public boolean onNavigationItemSelected(@NonNull MenuItem item) {
          switch (item.getItemId()) {
              case R.id.bottom_urgent:
                  urgent urgentfragment = urgent.newInstance();
                  setFragment(urgentfragment,false);
                  return true;
              case R.id.bottom_all:
                  all allfragment = all.newInstance();
                  setFragment(allfragment,false);
                  item.setChecked(true);
                  return true;
              case R.id.bottom_attendedto:
                  attendedto attendedtofragment = attendedto.newInstance();
                  setFragment(attendedtofragment,false);
                  item.setChecked(true);
                  return true;
  
          }
          return false;
      }
  };
  
  public void setFragment(Fragment fragment, boolean addtobackstack) {
      FragmentManager fragmentManager = getSupportFragmentManager();
      FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
      fragmentTransaction.replace(R.id.event_framelayout, fragment);
  
      if(!addtobackstack)
      {
          for(int i=0;i&lt; fragmentManager.getBackStackEntryCount();++i)
              fragmentManager.popBackStack();
      }
      else
      {
          fragmentTransaction.addToBackStack(null);
  
      }
  
      fragmentTransaction.commit();
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>This is the main activity xml</p>
  
  <pre><code>  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.constraint.ConstraintLayout 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"
      tools:context=".admin"&gt;
  
      &lt;FrameLayout
          android:id="@+id/event_framelayout"
          android:layout_width="0dp"
          android:layout_height="0dp"
          android:layout_marginBottom="8dp"
          android:layout_marginEnd="8dp"
          android:layout_marginStart="8dp"
          android:layout_marginTop="8dp"
          android:orientation="vertical"
          app:layout_constraintBottom_toTopOf="@+id/navigation"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintHorizontal_bias="1.0"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          app:layout_constraintVertical_bias="0.0" /&gt;
  
      &lt;android.support.design.widget.BottomNavigationView
          android:id="@+id/navigation"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:menu="@menu/navigation"
          app:itemIconTint="@color/colors_bottom_navigation"
          app:itemTextColor="@color/colors_bottom_navigation"
          app:itemBackground="@color/colorPrimaryDark"/&gt;
  
  
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p>This is the helper class that helps disabling the shift </p>
  
  <pre><code>   package com.prototypeapp.healer.healer.customviews;
  
  import android.annotation.SuppressLint;
  import android.support.design.internal.BottomNavigationItemView;
  import android.support.design.internal.BottomNavigationMenuView;
  import android.support.design.widget.BottomNavigationView;
  import android.util.Log;
  
  import java.lang.reflect.Field;
  
  public class BottomNavigationViewHelper {
  
      @SuppressLint("RestrictedApi")
      public static void disableShiftMode(BottomNavigationView view) {
          BottomNavigationMenuView menuView = (BottomNavigationMenuView) view.getChildAt(0);
          try {
              Field shiftingMode = menuView.getClass().getDeclaredField("mShiftingMode");
              shiftingMode.setAccessible(true);
              shiftingMode.setBoolean(menuView, false);
              shiftingMode.setAccessible(false);
              for (int i = 0; i &lt; menuView.getChildCount(); i++) {
                  BottomNavigationItemView item = (BottomNavigationItemView) menuView.getChildAt(i);
                  //noinspection RestrictedApi
                  item.setShiftingMode(false);
                  // set once again checked value, so view will be updated
                  //noinspection RestrictedApi
                  item.setChecked(item.getItemData().isChecked());
              }
          } catch (NoSuchFieldException e) {
              Log.e("BNVHelper", "Unable to get shift mode field", e);
          } catch (IllegalAccessException e) {
              Log.e("BNVHelper", "Unable to change value of shift mode", e);
          }
      }
  }
  </code></pre>