I too have experienced the same issue that Sundog has described.  In
my case I configured the animation in xml, but the result was exactly
the same.  Why does the animation run only once?

Thanks

On Jan 5, 12:57 pm, Sundog <michael_...@tmail.com> wrote:
> Perhaps a more specific question will help get a response: Am I using
> the INFINITE and RESTART in SetRepeatCount and SetRepeatMode
> correctly? Can someone tell me why this fires once, plays both
> animations and then stops?
>
> Thanks for any help, I have searched and found nothing.
>
> On Jan 4, 7:05 pm, Sundog <michael_...@tmail.com> wrote:
>
> > Hi, I need a bit of help understanding the animation repeat behavior.
>
> > In the following code, the intention is for the first animation to
> > run, then the second, then this sequence to repeat indefinitely.
> > Instead, both animations run once and then it stops. What am I doing
> > wrong?
>
> >         AnimationSet rootSet = new AnimationSet(true);
> >         rootSet.setInterpolator(new AccelerateInterpolator());
>
> >                        ScaleAnimation scale = new ScaleAnimation(
> >                                1, 1, 1, -1, // From x, to x, from y, to y
> >                                ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
> >                                ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
> >                                scale.setDuration(1600);
> >                                scale.setFillAfter(true);
>
> >                         ScaleAnimation scale2 = new ScaleAnimation(
> >                                        1, 1, -1, 1, // From x, to x, from 
> > y, to
> > y
> >                                        ScaleAnimation.RELATIVE_TO_SELF, 
> > 0.5f,
> >                                        ScaleAnimation.RELATIVE_TO_SELF, 
> > 0.5f);
> >                                         scale.setStartOffset(1600);
> >                                        scale.setDuration(1600);
> >                                        scale.setFillAfter(true);
>
> >                        AnimationSet childSet = new AnimationSet(true);
> >                        childSet.addAnimation(scale);
> >                        childSet.addAnimation(scale2);
> >                        childSet.setStartOffset(0);
> >                        childSet.setRepeatCount(Animation.INFINITE);
> >                        childSet.setRepeatMode(Animation.RESTART);
> >                       // childSet.addAnimation(rotate);
>
> >                        rootSet.addAnimation(childSet);
>
> >         ImageView b = (ImageView)findViewById(R.id.viewtoanimate);
>
> >         b.startAnimation(rootSet);
>
> > Thanks in advance, I know it's something obvious.
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to