in my app I have a button and set below animation to it
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/bounce_interpolator" >
<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"
/>
</set>
by this java code:
myAnim = AnimationUtils.loadAnimation(this, R.anim.anim_button);
Button myButton = (Button) findViewById(R.id.run_button);
myButton.setAnimation(myAnim);
myButton.startAnimation(myAnim);
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
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_button_focuses"
android:state_pressed="true"
android:state_enabled="true"/>
<item android:drawable="@drawable/ic_button_focuses"
android:state_focused="true"
android:state_enabled="true"/>
<item android:drawable="@drawable/ic_button"
/>
</selector>