how to move a button to left or right programmatically in android
android
Solution
Use a TranslateAnimation:
TranslateAnimation animation = new TranslateAnimation(start_x, start_y, end_x, end_y);
animation.setDuration(1000); // duartion in ms
animation.setFillAfter(false);
button.startAnimation(animation);
I'm not sure how you can get it's position, button.getTop() and button.getLeft() could work...
Problem
I want to animate a button by getting its co-ordinates and then increasing or decreasing them one by one so that the button can go to left and then come to the right.