OnTouchListener 在 TranslationAnimation 期间不翻译
OnTouchListener does not translate during TranslationAnimation
我对在屏幕上移动的 ImageView 有疑问。不幸的是,onTouch Event
仅在我触摸 ImageView 的原始位置时触发。当 imageView
移动时,它会忽略 onTouch 事件。综上所述,只有原位置才能触发OnTouch事件。
您应该使用 属性 动画而不是这些视图动画。处理触摸是使用此类动画的最重要原因之一。
ObjectAnimator anim = ObjectAnimator.ofFloat(view, "translationY", 0f, 100f);
anim.setDuration(1000);
anim.start();
如果您想了解更多信息,请关注此 link:
http://developer.android.com/guide/topics/graphics/prop-animation.html
我对在屏幕上移动的 ImageView 有疑问。不幸的是,onTouch Event
仅在我触摸 ImageView 的原始位置时触发。当 imageView
移动时,它会忽略 onTouch 事件。综上所述,只有原位置才能触发OnTouch事件。
您应该使用 属性 动画而不是这些视图动画。处理触摸是使用此类动画的最重要原因之一。
ObjectAnimator anim = ObjectAnimator.ofFloat(view, "translationY", 0f, 100f);
anim.setDuration(1000);
anim.start();
如果您想了解更多信息,请关注此 link: http://developer.android.com/guide/topics/graphics/prop-animation.html