Http://www.4byte.cn/question/634906/android-webview-can-t-be-scrolled-after-being-set-to-a-touch-listener.html
There are two events in motionevent that are worth noting, namely Action_down and Action_pointer_down.
Action_down: This is a good understanding when the screen detects that a finger has been pressed to trigger the event.
Action_pointer_down: This is the key to achieving multipoint, which triggers the event when the screen detects that multiple fingers have been pressed at the same time.
The current screen's event type can be obtained via getaction (): Action_down, Action_move, action_up, or Action_cancel. But if you get a action_pointer_down like that, you have to have action_mask with you to get the Action_pointer_down event.
@Override public boolean ontouch (View v, Motionevent event) { ImageView view = (ImageView) v; dumpevent (Event); // Handle touch events Here... switch (Event.getaction () & motionevent.action_mask) { case MotionEvent.ACTION_DOWN: matrix.sET (View.getimagematrix ()); savedmatrix.set (Matrix); start.set (Event.getx (), event.gety ()); &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;//LOG.D (TAG, " Mode=drag "); mode = DRAG; // LOG.D (tag, "Mode=none"); break; case MotionEvent.ACTION_POINTER_DOWN: olddist = spacing (Event); &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;//LOG.D (TAG, "oldDist=" + olddist); if (olddist > 10f) { savedmatrix.set (Matrix); midpoint (mid, event); mode = ZOOM; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;//LOG.D (tag, "Mode=zoom"); }// ACTION_DOWN, ACTION_MOVE, ACTION_UP, or ACTION_CANCEL. break; case motionevent.action_up: case MotionEvent.ACTION_POINTER_UP: mode = none; break; case MotionEvent.ACTION_MOVE: if (Mode == drag) { // ... matrix.set (SavedMatrix); matrix.posttranslate (Event.getX () - start.x, event.gety () - START.Y); } else if (mode == zoom) { float newdist = spacing (Event); &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;//LOG.D (TAG, "newDist=" + newdist); if (newdist > 10f) { &nBsp; matrix.set (Savedmatrix); float scale = newdist / olddist; matrix.postscale (scale, scale, mid.x, MID.Y); } } break; } view.setimagematrix (Matrix); return true; // indicate event was handled } private void Dumpevent (motionevent event) { String names[] = { "Down", "Up", "MOVE", " CANCEL ", " OUTSIDE ", "POINTER_DOWN", "POINTER_UP", "7", "8", "9?" }; Stringbuilder sb = new stringbuilder (); int action = event.getaction (); int actioncode = action & MotionEvent.ACTION_MASK; sb.append ("Event action_"). Append (Names[actioncode]); if (Actioncode == motionevent.action_pointer_down | | &NBSP;ACTIONCODE&NBSP;==&NBSP;MOTIONEVENT.ACTION_POINTER_UP) { Sb.append ("(pid "). Append ( action >> motionevent.action_pointer_id_ SHIFT); sb.append (")"); } &nbsP; sb.append ("["); for (Int i = 0; i < event.getpointercount ( ); i++) { sb.append ("#"). Append (i); sb.append ("(pid )"). Append (Event.getpointerid (i)); sb.append (") =" ). Append ((int) event.getx (i)); sb.append (","). Append ((int) Event.gety (i)); if (I + 1 < event.getpointercount ()) sb.append (";"); } sb.append ("]"); &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;//LOG.D (TAG, Sb.tostring ()); } /** * two points distance: */private float spacing (motionevent event) {float x = event.getx (0) - Event.getx (1); float y = event.gety (0) &NBSP;-&NBsp;event.gety (1); return floatmath.sqrt (x * x + y * y);} /** * two points between */private void midpoint (Pointf point, motionevent event) {float x = event.getx (0) + event.getx (1); float y = event.gety (0) + event.gety (1);p oint.set (X/2,&NBSP;Y/2);}
write the above code to Mulitpointtouchlistener. Java and then make the appropriate picture for you Ontouchlistener
For example: Imageview.setontouchlistener (New Mulitpointtouchlistener ()); in the XML to change the zoom format of the image to Matrix
"Android__webview" multi-touch for zooming and dragging pictures