-1

I used a custom layout with a ScaleGestureDectector class to zoom in, zoom out my custom view. My problem is when I zoom in at 3.0x and above, my custom layout cannot be zoomed out, and difficult to zoom in (too lag)

Here is my code :

private class ScaleGestureListener
        extends ScaleGestureDetector.SimpleOnScaleGestureListener {

@Override
public boolean onScale(ScaleGestureDetector detector) {
    float scaleFactor = mScaleFactor * detector.getScaleFactor();

    mScaleFactor = scaleFactor;
    setScaleX(getScaleX() * mScaleFactor);
    setScaleY(getScaleY() * mScaleFactor);

    invalidate();
    return true;
}

Have a solution for this problem?

nguoitotkhomaisao
  • 1,247
  • 1
  • 13
  • 24

1 Answers1

0

I made one example few years back and it was working fine on most of the devices. Not really sure if this helps you but take a look at the answer in the link below,

How does pinch zoom work with panning for image in Android

Community
  • 1
  • 1
Ahmed
  • 2,966
  • 7
  • 42
  • 69