Android如何在SimpleOnScaleGestureListener.onScale中左上角?

时间:2014-12-28 10:22:38

标签: android zoom surfaceview pan pinch

我将使用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;
    };

};

0 个答案:

没有答案