title: Android code to zoom and pan a Relative layout which contains text boxes, buttons, spinners, etc
body: <p>I have zoomed into the layout easily but I also want to scroll the zoomed layout. I have been able to zoom but I want to also have scrolling after I zoom so that I can edit the values of the <code>Widgets</code></p>
  
  <p>Is there any way to do this ?</p>
  
  <pre><code>    import android.app.TabActivity;
      import android.content.Intent;
      import android.os.Bundle;
      import android.view.View;
      import android.view.View.OnClickListener;
      import android.widget.RelativeLayout;
      import android.widget.TabHost;
      import android.widget.TabHost.TabSpec;
  
      public class MainActivity extends TabActivity {
          View mainview;
          int zoomed = 0;
          TabHost th;
          TabSpec one;
          TabSpec two;
          TabSpec three;
          TabSpec four;
  
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);
              mainview = (RelativeLayout) findViewById(R.id.relLayout1);
  
              th = getTabHost();
              th.setup();
              one = th.newTabSpec("One");
              two = th.newTabSpec("Two");
              three = th.newTabSpec("Three");
              four = th.newTabSpec("Four");
  
              one.setIndicator("One");
              two.setIndicator("Two");
              three.setIndicator("Three");
              four.setIndicator("Four");
  
              Intent a = new Intent(this, first.class);
              Intent b = new Intent(this, second.class);
              Intent c = new Intent(this, third.class);
              Intent d = new Intent(this, fourth.class);
  
              one.setContent(a);
              two.setContent(b);
              three.setContent(c);
              four.setContent(d);
  
              th.addTab(one);
              th.addTab(two);
              th.addTab(three);
              th.addTab(four);
  
              mainview.setOnClickListener(new OnClickListener() {
  
                  @Override
                  public void onClick(View arg0) {
  
                      mainview.setPivotX(100);
                      mainview.setPivotY(100);
                      if (zoomed == 0) {                  
                          mainview.setScaleX(2f);
                          mainview.setScaleY(2f);
                          zoomed=1;
                      }
                      else{
                          mainview.setScaleX(1f);
                          mainview.setScaleY(1f);
                          zoomed=0;
                      }
                  }
              });
          }
      }
  </code></pre>
  
  <p>And this is my layout : </p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/relLayout1"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".MainActivity" &gt;
  
      &lt;TabHost
          android:id="@android:id/tabhost"
          android:layout_width="match_parent"
          android:layout_height="220dp"
          android:layout_alignParentBottom="true"
          android:layout_alignParentLeft="true"
          android:layout_alignParentTop="true" &gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical" &gt;
  
              &lt;TabWidget
                  android:id="@android:id/tabs"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content" &gt;
              &lt;/TabWidget&gt;
  
              &lt;FrameLayout
                  android:id="@android:id/tabcontent"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent" &gt;
  
                  &lt;LinearLayout
                      android:id="@+id/tab1"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent" &gt;
                  &lt;/LinearLayout&gt;
  
                  &lt;LinearLayout
                      android:id="@+id/tab2"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent" &gt;
                  &lt;/LinearLayout&gt;
  
                  &lt;LinearLayout
                      android:id="@+id/tab3"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent" &gt;
                  &lt;/LinearLayout&gt;
  
                  &lt;LinearLayout
                      android:id="@+id/tab4"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent" &gt;
                  &lt;/LinearLayout&gt;
              &lt;/FrameLayout&gt;
          &lt;/LinearLayout&gt;
      &lt;/TabHost&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>