【发布时间】:2011-08-21 14:18:55
【问题描述】:
我在我的示例应用程序中使用手势监听器,我想在它的 onFling() 方法中执行旋转和平移动画。
个人都可以正常工作,但是当我将它集成到 Animation Set 时,它不能正常工作。
请建议我如何处理这个问题。
以下是我的 onFling 方法的代码:
onFling(MotionEvent e1, MotionEvent e2, 浮动速度X, 浮动速度Y) {
translateAnimation = new TranslateAnimation(0,x2,0,y2); // x2=e2.getX() and y2=e2.getY()
translateAnimation.setDuration(3000);
rotateAnimation = new RotateAnimation(0, 90, RotateAnimation.RELATIVE_TO_SELF, RotateAnimation.RELATIVE_TO_SELF);
rotateAnimation.setStartOffset(1400);
rotateAnimation.setInterpolator(new AccelerateInterpolator());
animationSet.addAnimation(translateAnimation);
animationSet.addAnimation(rotateAnimation);
animationSet.setAnimationListener(this);
animationSet.setDuration(3000);
lastView.startAnimation(animationSet);
}
非常感谢
【问题讨论】: