Thursday, March 15, 2012

[android-developers] AnimationSet seStartOffset not working

I'm using an AnimationSet to fade an ImageView out (alpha 1->0) and
then fade it back in (alpha 0->1). I can't seem to get the
AlphaAnimations to run sequentially, however. From the logs, I can
see that both animations always start simultaneously, even though I'm
adding a start offset to the second one. Can anyone tell me what I'm
doing wrong?

AnimationSet aSet = new AnimationSet(true);

// first fade the current image out
AlphaAnimation aa = new AlphaAnimation(1f, 0f);
aa.setDuration(350);
aSet.addAnimation(aa);

// next fade the last trick's card in
AlphaAnimation a2 = new AlphaAnimation(0f, 1f);
a2.setStartOffset(351);
a2.setDuration(350);
aSet.addAnimation(a2);

cardView.setAnimation(aSet);
cardView.invalidate();

I've got animation listeners assigned that log the start/end times of
each animation, and they confirm that both animations always start
simultaneously.

Thanks.

-rob

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate