0

I'm trying to make the ScrollView zoom-able following this post

 mScaleDetector = new ScaleGestureDetector(context,
     new ScaleGestureDetector.SimpleOnScaleGestureListener() {
     @Override
     public boolean onScale(ScaleGestureDetector detector) {
     float scale = 1 - detector.getScaleFactor();

     float prevScale = mScale;
     mScale += scale;

     if (mScale < 0.1f) // Minimum scale condition:
     mScale = 0.1f;

     if (mScale > 10f) // Maximum scale condition:
     mScale = 10f;
     ScaleAnimation scaleAnimation = new ScaleAnimation(
     1f / prevScale, 1f / mScale, 1f / prevScale,
     1f / mScale, detector.getFocusX(),
     detector.getFocusY());
     scaleAnimation.setDuration(0);
     scaleAnimation.setFillAfter(true);

     startAnimation(scaleAnimation);
     return true;
     }


     });

but the zooming scrolls only work up and down, i'm trying to make it scroll left and right too.

Community
  • 1
  • 1
A.AL
  • 135
  • 3
  • 12

1 Answers1

0

Scrollview only do Vertical scrolling while HorizontalScrollView does Horizontal scrolling.

No class (AFAIK) enable scrolling both axis, you can find on internet classes for that or write your own.

Marcos Vasconcelos
  • 18,136
  • 30
  • 106
  • 167