Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Applying two animations in the same animation xml file

I would like to know if it is possible to apply one animation with two scale animations in the same xml file lets say I have

animation.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">

   <alpha
       android:fromAlpha = "1.0"
       android:toAlpha = "0.5"
       android:duration = "300">
   </alpha>
   <scale
       android:fromXScale = "1"
       android:toXScale = "1.3"
       android:fromYScale = "1"
       android:toYScale = "1.3"
       android:pivotX="50%"
       android:pivotY="50%"
       android:duration = "50">
   </scale>

   <scale
       android:fromXScale = "1"
       android:toXScale = "1.3"
       android:fromYScale = "1"
       android:toYScale = "1.3"
       android:pivotX="50%"
       android:pivotY="50%"
       android:duration = "50">
   </scale>

then apply this animation on an ImageView in a way so it does animation 1 then animation 2?

instead of creating two seperate animations and adding an animation listener to my first animation to execute animation2 when one is finished...

like image 915
Amro elaswar Avatar asked Nov 27 '25 13:11

Amro elaswar


1 Answers

Yes you can use:

 android:ordering="sequentially"

for the set so it animating sequentially. take a look at this for further information.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!