Tell me how to make an animation in ImageButton through Scale so that it decreases to a certain point and immediately returns to its original size.

Tried so

<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator"> <scale android:fromXScale="0.1" android:toXScale="1.0" android:fromYScale="0.1" android:toYScale="1.0" android:duration="1000" android:pivotX="50%" android:pivotY="50%" android:startOffset="100" /> </set> 

but the button is greatly reduced sharply and smoothly to its original state, but I would like it to decrease slightly, and also return smoothly. Type of pressing effect

    1 answer 1

    Try this, on the device did not check, it should work

     <scale android:fromXScale="0.1" android:toXScale="1.0" android:fromYScale="0.1" android:toYScale="1.0" android:pivotX="50%" android:pivotY="50%" android:duration="500" android:repeatCount="1" android:repeatMode="reverse" /> 
    • Thank you, redid your code a bit and achieved the desired effect - Christina
    • And what exactly changed? - DevOma
    • Instead of fromXScale = "0.1" wrote 0.8 and removed android: repeatCount and android: repeatMode - Cristina
    • Because of these attributes, it seems to me there was a ripple effect. - Christine
    • Clear, helpful. - DevOma