I\'m developing an Android 2.2 application.
I want to move an image from left side of the screen to the right side of the screen.
How can I do that? I\'ve read t
you have to use Translate Animation. For example, this animation would move an image from Left side of the screen to the right side of the screen.
The AnimationActivity is
listener = new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {}
@Override
public void onAnimationRepeat(Animation animation) {}
@Override
public void onAnimationEnd(Animation animation) {
System.out.println("End Animation!");
//load_animations();
}
};
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (v==button)
{
moveLefttoRight = new TranslateAnimation(0, 200, 0, 0);
moveLefttoRight.setDuration(1000);
moveLefttoRight.setFillAfter(true);
my_image.startAnimation(moveLefttoRight);
}
}
}
xml code is
and anim file is
may be this is the answer what you are searching.