Is it possible to have a view who supports horizontal and vertical pan/drag. On top of that, I want to be able to pinch to zoom and double tap to zoom. Does this view exists
To get better permormance of Zooming in Alex's code add following changes
private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
@Override
public boolean onScale(ScaleGestureDetector detector) {
mScaleFactor *= detector.getScaleFactor();
if (detector.isInProgress()) {
mFocusX = detector.getFocusX();
mFocusY = detector.getFocusY();
}
mFocusX = (mFocusX + mLastTouchX)/2; // get center of touch
mFocusY = (mFocusY + mLastTouchY)/2; // get center of touch
mScaleFactor = Math.max(1f, Math.min(mScaleFactor, 2.0f));
mScaleMatrix.setScale(mScaleFactor, mScaleFactor,mFocusX, mFocusY);
mScaleMatrix.invert(mScaleMatrixInverse);
invalidate();
requestLayout();
return true;
}
}