title: How to combine horizontal pager and vertical pager in a single view in android?
body: <p>I'm not sure how to integrate both these pagers in a single view. What I wanna do is, the images should have the ability to be swiped both vertically and horizontally. This screen would have a page indicator in the screen. </p>
  
  <pre><code>    scrollView = (ScrollView) findViewById(R.id.scroll_view);
      contentView = (ViewGroup) findViewById(R.id.content);
  
      scrollView.setOnTouchListener(new ScrollPager(scrollView, contentView));
      scrollView.post(new Runnable()
      {
              public void run()
              {
                      scrollView.scrollTo(0, contentView.getPaddingTop());
              }
      });        
  
      final PagerControl control = (PagerControl) findViewById(R.id.control);
      final HorizontalPager pager = (HorizontalPager) findViewById(R.id.pager);
      control.setNumPages(pager.getChildCount());
  
      pager.addOnScrollListener(new HorizontalPager.OnScrollListener() {
          public void onScroll(int scrollX) {
              //Log.d("TestActivity", "scrollX=" + scrollX);
              float scale = (float) (pager.getPageWidth() * pager.getChildCount()) /    (float) control.getWidth();
              control.setPosition((int) (scrollX / scale));
  
          }
  
          public void onViewScrollFinished(int currentPage) {
              //Log.d("TestActivity", "viewIndex=" + currentPage);
              control.setCurrentPage(currentPage);
          }
      });
  </code></pre>
  
  <p>and xml is </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:example="http://schemas.android.com/apk/res/com.example.page"
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
  &gt;
  &lt;com.example.page.HorizontalPager
      android:id="@+id/pager"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      example:pageWidth="250dip"
      &gt;
  &lt;ScrollView
      xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/scroll_view"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"&gt;
  
  &lt;LinearLayout
    android:id="@+id/content"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:paddingTop="200dip"
    android:paddingBottom="200dip"&gt; 
      &lt;TextView
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:gravity="center"
          android:background="#0a0"
          android:text="Text 1"
          android:focusable="true"
          /&gt;
  
      &lt;TextView
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:gravity="center"
          android:background="#00a"
          android:text="Text 2"
          android:focusable="true"
          /&gt;
  
      &lt;Button
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:text="Text 3"
          /&gt;
  
      &lt;TextView
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:gravity="center"
          android:background="#a00"
          android:text="Text 4"
          android:focusable="true"
          /&gt;
  
      &lt;TextView
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:gravity="center"
          android:background="#0aa"
          android:text="Text 5"
          android:focusable="true"
          /&gt;
  &lt;/ScrollView&gt; 
  &lt;/com.example.page.HorizontalPager&gt;
  &lt;com.example.page.PagerControl
      android:id="@+id/control"
      android:layout_width="fill_parent"
      android:layout_height="4dip"
      android:layout_margin="8dip"
      example:roundRectRadius="2dip"
      /&gt;
   &lt;/LinearLayout&gt;
  </code></pre>