SimpleOnScaleGestureListener receives only the onScaleBegin event

I am trying to implement onscalegesturelistener. My problem is that SimpleOnScaleGestureListener receives the onScaleBegin event. Other events are not reported. I use Nexus One for testing

public class ZoomHandler extends SimpleOnScaleGestureListener { public float zoom; public ZoomHandler(float zm) { this.zoom = zm; } public boolean onScale(ScaleGestureDetector arg0) { Log.i("SCALE", "onscale " + arg0.getScaleFactor()); this.zoom *= arg0.getScaleFactor(); // Don't let the object get too small or too large. this.zoom = Math.max(0.1f, Math.min(this.zoom, 5.0f)); return true; } @Override public boolean onScaleBegin(ScaleGestureDetector arg0) { Log.i("SCALE", "onscalebegin " + arg0.getScaleFactor()); return false; } @Override public void onScaleEnd(ScaleGestureDetector arg0) { Log.i("SCALE", "onscaleend " + arg0.getScaleFactor()); } } 

In my activity I do this:

 .... mScaleDetector = new ScaleGestureDetector(this , new ZoomHandler(this.zoom)); @Override public boolean onTouchEvent(MotionEvent event) { this.mScaleDetector.onTouchEvent(event); ..... } .... 

thanks a lot

+4
source share
1 answer

The return values ​​of onScaleBegin () and onScale () determine whether or not to continue the sequence. If onScaleBegin () returns false, just like yours, none of the others will be launched.

+15
source

All Articles