我正在通过动画移动按钮,并且按钮在视觉上移动,但是当我在新位置按下按钮时,我在那儿找不到它。

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);


当我按下字母按钮时,我进入了人体活动,而当我按下字母按钮顶部的某处时,我进入了字母活动。

最佳答案

我仍然是一个初学者,但是我认为使用animation类只能设置view's可绘制状态的动画,而不是其绑定/触摸区域的动画。
尝试使用此:

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();

10-07 19:23