动画仅移动屏幕上的像素,而不移动对象的位置.为了让你留在它的最后,设置你的
animation.setFillAfter(true);
要实际移动对象的位置,请查看使用以下代码段的修改版本.
MarginLayoutParams marginParams = new MarginLayoutParams(object.getLayoutParams());
marginParams.setMargins(left, (top+hol2), left, 0);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(marginParams);
object.setLayoutParams(layoutParams);
关于多次调用onAnimationEnd,我需要看一些代码.
我知道手动停止动画的唯一两种方法是
animation.cancel(); (may not work for 2.1, can't remember)
要么
object.clearAnimation();
示例代码如下:
upmotionleft = new TranslateAnimation(0, 0, 0, 600);
upmotionleft.setDuration(2000);
upmotionleft.setFillEnabled(true);
upmotionleft.setAnimationListener(new Animation.AnimationListener()
{
@Override
public void onAnimationStart(Animation animation)</