I'm trying to make a simple set of animations repeat. Based on
documentation, it appears that below should work but the animation
runs once and does not repeat. Any pointers would be appreciated.
Thanks
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView animWindow = (TextView)findViewById(R.id.anim_text);
AnimationSet rootSet = new AnimationSet(true);
rootSet.setInterpolator(new AccelerateInterpolator());
// Create and add first child, a motion animation.
TranslateAnimation trans1 = new TranslateAnimation(0, 30, 0,
0);
trans1.setStartOffset(0);
trans1.setDuration(800);
trans1.setFillAfter(true);
rootSet.addAnimation(trans1);
// Add a final motion animation to the root set.
TranslateAnimation trans2 = new TranslateAnimation(0, 0, 0,
100);
trans2.setFillAfter(true);
trans2.setDuration(800);
trans2.setStartOffset(800);
rootSet.addAnimation(trans2);
rootSet.setRepeatCount(Animation.INFINITE);
rootSet.setRepeatMode(Animation.RESTART);
// Start the animation.
animWindow.startAnimation(rootSet);
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---