title: ImageView Pinch Zoom
body: <p>Hi i want zoom on imageview. i set zoom event. But i can't change when zoommed place. Can you help me?</p>
  
  <p>activity_main.xml</p>
  
  <pre><code>&lt;ImageView
      android:id="@+id/imageView"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:scaleType="matrix"
      android:src="@mipmap/asd" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>MainActivtiy.class</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  ImageView imageView;
  android.graphics.Matrix matrix = new android.graphics.Matrix();
  Float scale = 1f;
  ScaleGestureDetector SGD;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      imageView = (ImageView) findViewById(R.id.imageView);
      SGD = new ScaleGestureDetector(this,new ScaleListener());
  
  }
  
  private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener{
      @Override
      public boolean onScale(ScaleGestureDetector detector) {
          scale = scale * detector.getScaleFactor();
          scale = Math.max(0.1f,Math.min(scale,5f));
          matrix.setScale(scale, scale);
          imageView.setImageMatrix(matrix);
          return true;
      }
  }
  
  @Override
  public boolean onTouchEvent(MotionEvent event) {
      SGD.onTouchEvent(event);
      return true;
  }
  </code></pre>
  
  <p>}</p>