将图像滑动到屏幕外

时间:2015-02-07 16:29:55

标签: android

如何将图像滑动到屏幕的左上角?

请参阅我的图片

enter image description here

此动画应该很慢

我尝试使用以下代码但不起作用!

public Animation fromAtoB(View v, float fromX, float fromY, float toX, float toY, int speed, AnimationListener l)
{
    Animation fromAtoB = new TranslateAnimation(Animation.ABSOLUTE, fromX, Animation.ABSOLUTE, toX, Animation.ABSOLUTE, fromY, Animation.ABSOLUTE, toY );
    fromAtoB.setDuration(speed);
    if(l != null)
    {
        fromAtoB.setAnimationListener(l);               
    }
    v.setAnimation(fromAtoB);
    v.startAnimation(fromAtoB);
    return fromAtoB;
}

请告知,谢谢

0 个答案:

没有答案