我将使用ScaleGestureDetector缩放surfaceview,而不是onDraw()。
如何在SimpleOnScaleGestureListener.onScale中获得CustomSurfaceView的左上角?
private SimpleOnScaleGestureListener mSimpleListener = new ScaleGestureDetector.SimpleOnScaleGestureListener() {
@Override
public boolean onScale(ScaleGestureDetector detector) {
int left = (int) (detector.getPreviousSpanX());
int top = (int) (detector.getPreviousSpanY());
int right = (int) (detector.getCurrentSpanX()-detector.getPreviousSpanX());
int bottom = (int) (detector.getCurrentSpanY()-detector.getPreviousSpanY());
mCustomSurfaceView.layout(left, top, right, bottom);
invalidate();
return true;
};
};