title: Android Imageview Rotate Animation in NavigationView
body: <p>I want to apply <strong>Animation</strong> in my <strong>Image View</strong> inside <strong>Navigation View</strong>.</p>
  
  <p>I saw its working fine in some other apps. I have tried with following code but its not working for me.</p>
  
  <p><a href="https://i.stack.imgur.com/vXgj7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vXgj7.png" alt="enter image description here"></a></p>
  
  <p><strong>drawer_menu.xml</strong></p>
  
  <pre><code>&lt;menu xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"&gt;
  
      &lt;group android:checkableBehavior="single"&gt;
          &lt;item
              android:id="@+id/nav_logout"
              android:icon="@drawable/ic_logout"
              android:title="@string/nav_menu_logout" /&gt;
      &lt;/group&gt;
  
      &lt;group
      android:id="@+id/menu_sync"
      android:checkableBehavior="single"&gt;
          &lt;item
              android:id="@+id/nav_sync_now"
              android:title="@string/string_menu_sync_now"
              app:actionLayout="@layout/layout_menu_sync_now"
              app:showAsAction="always" /&gt;
      &lt;/group&gt;
  
  &lt;/menu&gt;
  </code></pre>
  
  <p><strong>NavigationActivity.java</strong></p>
  
  <pre><code>runOnUiThread(new Runnable() {
              @Override
              public void run() {
  
                  MenuItem menuItemSync = navigationBinding.navView.getMenu().findItem(R.id.nav_sync_now);
                  menuItemSync.setEnabled(false);
                  menuItemSync.setTitle(R.string.string_menu_syncing);
                  mImageViewSyncing = (AppCompatImageView) menuItemSync.getActionView().findViewById(R.id.nav_sync_now_image_view);
                  mImageViewSyncing.setColorFilter(ContextCompat.getColor(mContext, R.color.colorAccent));
  
                  /* Create Animation */
                  Animation mRotateAnimation = AnimationUtils.loadAnimation(mContext, R.anim.button_rotate);
  
                  /* start Animation */
                  mImageViewSyncing.startAnimation(mRotateAnimation);
              }
          });
  </code></pre>
  
  <p><strong>button_rotate.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;set xmlns:android="http://schemas.android.com/apk/res/android"
  android:shareInterpolator="false"&gt;
  
  &lt;rotate
      android:duration="2500"
      android:interpolator="@android:anim/linear_interpolator"
      android:pivotX="50%"
      android:pivotY="50%"
      android:repeatCount="infinite"
      android:repeatMode="restart"
      android:toDegrees="0"
      android:fromDegrees="360"/&gt;
  
  &lt;/set&gt;
  </code></pre>
  
  <p><strong>layout_menu_sync_now.xml</strong></p>
  
  <pre><code>&lt;android.support.v7.widget.AppCompatImageView
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:id="@+id/nav_sync_now_image_view"
      android:layout_width="24dp"
      android:layout_height="match_parent"
      android:adjustViewBounds="true"
      android:layout_gravity="end|center_vertical"
      app:srcCompat="@drawable/ic_sync_black" /&gt;
  </code></pre>
  
  <p>Is there any suggestion what to do?</p>
  
  <p>Thanks in advance.</p>