title: stop animation when button pressed
body: <p>in my app I have a button and set below animation to it</p>
  
  
  
  <pre><code>&lt;set xmlns:android="http://schemas.android.com/apk/res/android"
      android:interpolator="@android:anim/bounce_interpolator" &gt;
  
      &lt;scale
          android:duration="2000"
          android:fromXScale="0.9"
          android:toXScale="1.0"
          android:fromYScale="0.9"
          android:toYScale="1.0"
          android:pivotX="50%"
          android:pivotY="50%"
          android:repeatCount="infinite"
         /&gt;
  
  &lt;/set&gt;
  </code></pre>
  
  <p>by this java code:</p>
  
  <pre><code> myAnim = AnimationUtils.loadAnimation(this, R.anim.anim_button);
      Button myButton = (Button) findViewById(R.id.run_button);
      myButton.setAnimation(myAnim);
      myButton.startAnimation(myAnim);
  </code></pre>
  
  <p>now I want when button is focused (or pressed) the animation stopped and the size of my button reduced (for example from width 120dp to width 100dp)
  how can I do it? also I set below XML for my button</p>
  
  <pre><code>&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;item android:drawable="@drawable/ic_button_focuses"
          android:state_pressed="true"
          android:state_enabled="true"/&gt;
      &lt;item android:drawable="@drawable/ic_button_focuses"
          android:state_focused="true"
          android:state_enabled="true"/&gt;
      &lt;item android:drawable="@drawable/ic_button"
          /&gt;
  &lt;/selector&gt;
  </code></pre>