We want an image moving
forward and back in some space.
Copy this lines to below
findViewById.
TranslateAnimation move = new
TranslateAnimation(0, 200, 0, 0);
move.setDuration(2000);
move.setRepeatCount(Animation.INFINITE);
move.setRepeatMode(Animation.REVERSE);
move.setFillAfter(true);
image.startAnimation(move);
Value 200 in the line
new TranslateAnimation(0, 200, 0, 0); mean the long road image wil travel.
Change value in
the line setDuration(2000); if you
want image moving fast or slow.
If you want image stop, use
this.
image.clearAnimation();
No comments:
Post a Comment