Adil Ahmed Chowdhury
Adil Ahmed Chowdhury

Reputation: 367

Android animation in button

i am moving my button by animation and button moving visually but when i press the button at new position i don't find it there.

final Animation animation1 = new TranslateAnimation(0,0,0,100);
animation1.setDuration(5000);
animation1.setFillAfter(true);
alphabet.startAnimation(animation1);
humanbody.startAnimation(animation1);
poem.startAnimation(animation1);
game.startAnimation(animation1);

When I press alphabet button,it took me to human-body activity And I press somewhere top of alphabet button it took me to alphabet activity

Upvotes: 0

Views: 53

Answers (1)

Alex Herrera
Alex Herrera

Reputation: 61

I'm still a beginner at this, but I think that using the animation class only animates the view's drawable state, not the its bound/touch area. Try using this:

int t = 5000;
int y = 100;
alphabet.animate().setDuration(t).translateY(y).start();
humanbody.animate().setDuration(t).translateY(y).start();
poem.animate().setDuration(t).translateY(y).start();
game.animate().setDuration(t).translateY(y).start();

Upvotes: 1

Related Questions