使用android GestureOverlayView
我想检测所绘制手势的两个端点。在下图中,我必须检测以圆圈绘制的点。
是否可以这样做,或者我使用GestureOverlayView
使用了错误的方法?
答案 0 :(得分:1)
处理此问题的最简单方法是实现View.OnTouchListener
@Override
public boolean onTouch(View v, MotionEvent event)
{
float x = event.getX();
float y = event.getY();
switch(event.getAction())
{
case MotionEvent.ACTION_DOWN:
// A pressed gesture has started, the motion contains the initial starting location.
break;
case MotionEvent.ACTION_MOVE:
// A change has happened during a press gesture (between ACTION_DOWN and ACTION_UP).
break;
case MotionEvent.ACTION_UP:
// A pressed gesture has finished, the motion contains the final release location
// as well as any intermediate points since the last down or move event.
break;
}
return false; //True if the listener has consumed the event, false otherwise.
}
答案 1 :(得分:0)