重写Activity的onTouchEvent方法:
float x_temp01 = 0.0f;
float y_temp01 = 0.0f;
float x_temp02 = 0.0f;
float y_temp02 = 0.0f;
@Override
public boolean onTouchEvent(MotionEvent event)
{
//获得当前坐标
float x = event.getX();
float y = event.getY();
switch(event.getAction())
{
case MotionEvent.ACTION_DOWN:
{
x_temp01 = x;
y_temp01 = y;
}
break;
case MotionEvent.ACTION_UP:
{
x_temp02 = x;
y_temp02 = y;