1

Consider the following:

Animation foo = AnimationUtils.loadAnimation(parentActivity, R.anim.scale_up);

With the respective XML resource being defined as

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
     android:interpolator="@android:anim/accelerate_decelerate_interpolator"
     android:fillBefore="true"
     android:fillAfter="false"
     android:fillEnabled="true">

    <scale
        android:fromXScale="0.00"
        android:fromYScale="0.00"
        android:toXScale="1.00"
        android:toYScale="1.00"
        android:pivotX="50%"
        android:pivotY="50%"
        android:duration="50"
        android:repeatCount="0"/>

</set>

Can animation objects created in this manner Animation foo be applied to multiple view objects?

view1.startAnimation(foo);
view2.startAnimation(foo);
view3.startAnimation(foo);

What happens when view1.clearAnimation();? Do the animations stop for other views too?

Is the Animation foo object something that stores state and thus should not be applied to multiple views (e.g. bouncy button effects)

or is it just an object that holds some static definitions of the parsed XML file and can be readily created once before being reused multiple times?

AlanSTACK
  • 5,525
  • 3
  • 40
  • 99

0 Answers0