title: How to zoom an ImageView when click a button in android
body: <p>I have a requirement where I have an ImageView and two buttons for zoom-in and zoom-out. I want to zoom the image when I click the button. I searched the google and StackOverFlow, but unfortunately unable to found a solution. </p>
  
  <p>Therefore can someone help me? If you can give me a sample code or link that would be very much appriciated. </p>
  
  <p>Here is the code which I am trying.</p>
  
  <p><strong>Main.xml</strong></p>
  
  <pre><code>&lt;merge xmlns:android="http://schemas.android.com/apk/res/android" &gt;
  
      &lt;ImageView
          android:id="@+id/imgView"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:contentDescription="@string/imgCamera"
          android:layout_weight="1"
          android:scaleType="fitXY"
          android:layout_centerHorizontal="true"
          android:layout_centerVertical="true"
          android:adjustViewBounds="true"
          android:src="@drawable/matterhorn" /&gt;
  
       &lt;Button
          android:id="@+id/btnZoomIn"
          android:layout_width="65dp"
          android:layout_height="35dp"
          android:layout_gravity="bottom|left"
          android:layout_marginLeft="260dp"
          android:layout_marginBottom="15dp"
          android:layout_weight="1"
          android:text="Zoom In"
          android:background="@android:color/transparent"
          android:drawableLeft="@drawable/btn_icon_zoom_in"
          &gt;
      &lt;/Button&gt;
  
      &lt;Button
          android:id="@+id/btnZoomOut"
          android:layout_width="65dp"
          android:layout_height="35dp"
          android:layout_gravity="bottom|left"
          android:layout_marginLeft="330dp"
          android:layout_marginBottom="15dp"
          android:layout_weight="1"
          android:text="Zoom Out"
          android:background="@android:color/transparent"
          android:drawableLeft="@drawable/btn_icon_zoom_out"
          &gt;
      &lt;/Button&gt;
  &lt;/merge&gt;
  </code></pre>
  
  <p><strong>This is my main Activity "ZoomActivity.java" in which the event will be handle</strong> </p>
  
  <pre><code>package com.image.zoomcontrol;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.ImageView;
  
  public class ZoomActivity extends Activity implements OnClickListener {
  
      private ImageView imgview;
      private Button btnZoomIn;
      private Button btnZoomOut;
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          imgview = (ImageView) findViewById(R.id.imgView);
  
          btnZoomIn = (Button) findViewById(R.id.btnZoomIn);
          btnZoomIn.setOnClickListener(this);
  
          btnZoomOut = (Button) findViewById(R.id.btnZoomOut);
          btnZoomOut.setOnClickListener(this);
  
      }
  
      @Override
      public void onClick(View v) {
          switch (v.getId()) {
          case R.id.btnZoomIn:
              // Here I need Zoom in Code
              break;
  
          case R.id.btnZoomOut:
              // Here I need Zoom out Code
              break;
          }
      }
  }
  </code></pre>
  
  <p>Thanks in advance.</p>