两个小工具类
//计算两指间距离
private double spacing(MotionEvent event){
float x = 0;
float y = 0;
x = event.getX(0) - event.getX(1);
y = event.getY(0) - event.getY(1);
return Math.sqrt(x*x + y*y);
}
//计算两指的中点
private PointF mypoint(MotionEvent event){
float x1 = event.getX(0);
float x2 = event.getX(1);
float y1 = event.getY(0);
float y2 = event.getY(1);
float x = (x1 + x2) / 2;
float y = (y1 + y2) / 2;
PointF pointF = new PointF(x, y);
return pointF;
}