title: Android: viewpager Touch Events does not Working
body: <p>I have a webview and ViewPager in LinearLayout.</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:fitsSystemWindows="true"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  &lt;FrameLayout 
      android:id="@+id/webview_wrapper"
      android:layout_width="match_parent"
      android:layout_height="0dip"
      android:layout_weight="1" /&gt;
  
  
  &lt;android.support.v4.view.ViewPager 
      android:id="@+id/slide_page"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:background="#696969" 
      android:focusable="true"
      android:focusableInTouchMode="true"
      android:visibility="gone" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>While I set OnTouchListener on both webview and ViewPager.
  I try to start drag on webview and pass the MotionEvent to viewPager when I am in dragging.</p>
  
  <p>My code is as below.</p>
  
  <pre><code>    WebView mainView  = tab.getWebView();
      mainView.setOnTouchListener(new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent e) {
              Log.w("LOGTAG", "onTouch");                     
              switch (e.getAction() &amp; MotionEvent.ACTION_MASK) {
                  case MotionEvent.ACTION_DOWN:
                      Log.w("LOGTAG", "ACTION_UP");
                      break;
                  case MotionEvent.ACTION_MOVE:
                      Log.w("LOGTAG", "ACTION_MOVE");
                      Test(...);
                      mPager.dispatchTouchEvent(e);
                      break;
                  case MotionEvent.ACTION_UP: 
                      Log.w("LOGTAG", "ACTION_UP");
                      break;
             }
             return false;
         }
     });
  
          private void Test(...) {
              FrameLayout wrapper =
                  (FrameLayout) container.findViewById(R.id.webview_wrapper); 
              mPager = (ViewPager)container.findViewById(R.id.slide_page);
              ...
              wrapper.setVisibility(View.GONE);
              mPager.setVisibility(View.VISIBLE);        
              mPager.setOnTouchListener(new OnTouchListener() {
  
                  @Override
                  public boolean onTouch(View v, MotionEvent e) {
                      Log.w("LOGTAG", "mPager.onTouch");            
  
                      switch (e.getAction() &amp; MotionEvent.ACTION_MASK) {
  
                          case MotionEvent.ACTION_DOWN:
                              Log.w("LOGTAG", "mPager.ACTION_DOWN");                      
                              break;
                          case MotionEvent.ACTION_MOVE:
                              Log.w("LOGTAG", "mPager.ACTION_MOVE");
                              break;
                          case MotionEvent.ACTION_UP: 
                              Log.w("LOGTAG", "mPager.ACTION_UP");
                              break;
                      }
                      return false;
                  }
              });
          }
  </code></pre>
  
  <p>Here is my log:</p>
  
  <p>...</p>
  
  <p>08-06 07:09:16.321: W/(26460): mPager.dispatchTouchEvent(e) = true</p>
  
  <p>08-06 07:09:16.321: W/(26460): onTouch</p>
  
  <p>08-06 07:09:16.321: W/(26460): ACTION_MOVE</p>
  
  <p>08-06 07:09:16.321: W/(26460): mPager.onTouch</p>
  
  <p>08-06 07:09:16.321: W/(26460): mPager.ACTION_MOVE</p>
  
  <p>...</p>
  
  <p>ViewPager onTouchListener detected MotionEvent well, but viewpager did not move.</p>
  
  <p>Any help will be greatly appreciated.</p>