title: TabLayout inside ViewPager prohibits swiping
body: <p>I have the following <code>ViewPager</code>'s <strong>FINANCIAL</strong> fragment page.</p>
  
  <p><a href="https://i.stack.imgur.com/VslMM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VslMM.png" alt="enter image description here"></a></p>
  
  <p>It is built using the following mythology</p>
  
  <pre><code>this.detailedStockFragmentPagerAdapter = new DetailedStockFragmentPagerAdapter(this.getSupportFragmentManager(), bundle);
  viewPager.setAdapter(detailedStockFragmentPagerAdapter);
  viewPager.setOffscreenPageLimit(Math.max(1, detailedStockFragmentPagerAdapter.getCount() - 1));
  tabLayout.setupWithViewPager(viewPager);
  
  private static class DetailedStockFragmentPagerAdapter extends FragmentPagerAdapter {
      public DetailedStockFragmentPagerAdapter(FragmentManager fm, Bundle bundle) {
          super(fm);
          this.bundle = bundle;
      }
  
      @Override
      public int getCount() {
          return 3;
      }
  
      @Override
      public Fragment getItem(int position) {
          switch (position) {
              case 0:
              {
                  ...
              }
              case 1:
              {
                  ...
              }
              case 2:
              {
                  FinancialFragment financialFragment = FinancialFragment.newInstance();
                  financialFragment.setArguments(bundle);
                  return financialFragment;
              }
              default:
                  assert(false);
          }
          return null;
      }
  
      @Override
      public CharSequence getPageTitle(int position) {
          switch (position) {
              case 0:
                  return JStockApplication.instance().getString(R.string.info);
              case 1:
                  return JStockApplication.instance().getString(R.string.news);
              case 2:
                  return JStockApplication.instance().getString(R.string.financial);
              default:
                  return null;
          }
      }
  }
  </code></pre>
  
  <p>In <strong>FINANCIAL</strong> page, there are 3 components</p>
  
  <ol>
  <li>Button</li>
  <li>TextView</li>
  <li>inner TabLayout (The bar with 1D, 1W, 1M, 3M, ...)</li>
  </ol>
  
  <p>If I touch any of the following components, and swipe toward right, it works as expected. </p>
  
  <ol>
  <li>Button</li>
  <li>TextView</li>
  <li>Any empty area of the fragment</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/VvOvI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VvOvI.png" alt="enter image description here"></a></p>
  
  <hr>
  
  <p><strong><em>However, if my touch area is inner <code>TabLayout</code>, swipe doesn't work. It seems that the <code>TabLayout</code> has "eaten" my swipe event.</em></strong></p>
  
  <p>Any idea how I can have inner <code>TabLayout</code> in <code>ViewPager</code> fragment, yet doesn't affect my swipe event?</p>
  
  <p>The XML of my <code>ViewPager</code> fragment page is as follow</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"&gt;
  
      &lt;Button
          android:layout_marginBottom="20dp"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="This is button"
          android:textSize="18sp" /&gt;
  
      &lt;TextView
          android:layout_marginBottom="20dp"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textColor="#ff000000"
          android:textSize="18sp"
          android:text="This fragment is not scrollable. How to make toolbar visible?"/&gt;
  
      &lt;LinearLayout
          android:id="@+id/period_tablayout_linear_layout"
          android:layout_width="match_parent"
          android:layout_height="38dp"
          android:orientation="vertical"&gt;
  
          &lt;android.support.design.widget.TabLayout
              android:id="@+id/period_tab_layout"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_marginLeft="5dp"
              android:layout_marginRight="5dp"
  
              app:tabTextAppearance="@style/TradingChartPeriodTabTextAppearance"
              app:tabPaddingStart="0dp"
              app:tabPaddingEnd="0dp"
              app:tabIndicatorHeight="2dp"
              app:tabMode="fixed"
              app:tabGravity="fill"
              app:tabBackground="?attr/tradingHistorySummaryChartBackgroundColor"
              app:tabSelectedTextColor="?attr/primaryTextColor"
              app:tabIndicatorColor="?attr/primaryTextColor"&gt;
  
              &lt;android.support.design.widget.TabItem
                  android:id="@+id/tab_item_1d"
                  android:layout_height="wrap_content"
                  android:layout_width="0dp"
                  android:layout_weight="1"
                  android:text="@string/trading_day_1_short" /&gt;
  
              &lt;android.support.design.widget.TabItem
                  android:id="@+id/tab_item_1w"
                  android:layout_height="wrap_content"
                  android:layout_width="0dp"
                  android:layout_weight="1"
                  android:text="@string/trading_week_1_short" /&gt;
  
              &lt;android.support.design.widget.TabItem
                  android:id="@+id/tab_item_1m"
                  android:layout_height="wrap_content"
                  android:layout_width="0dp"
                  android:layout_weight="1"
                  android:text="@string/trading_month_1_short" /&gt;
  
              &lt;android.support.design.widget.TabItem
                  android:id="@+id/tab_item_3m"
                  android:layout_height="wrap_content"
                  android:layout_width="0dp"
                  android:layout_weight="1"
                  android:text="@string/trading_months_3_short" /&gt;
  
              &lt;android.support.design.widget.TabItem
                  android:id="@+id/tab_item_6m"
                  android:layout_height="wrap_content"
                  android:layout_width="0dp"
                  android:layout_weight="1"
                  android:text="@string/trading_months_6_short" /&gt;
  
              &lt;android.support.design.widget.TabItem
                  android:id="@+id/tab_item_1y"
                  android:layout_height="wrap_content"
                  android:layout_width="0dp"
                  android:layout_weight="1"
                  android:text="@string/trading_year_1_short" /&gt;
  
              &lt;android.support.design.widget.TabItem
                  android:id="@+id/tab_item_5y"
                  android:layout_height="wrap_content"
                  android:layout_width="0dp"
                  android:layout_weight="1"
                  android:text="@string/trading_years_5_short" /&gt;
  
              &lt;android.support.design.widget.TabItem
                  android:id="@+id/tab_item_10y"
                  android:layout_height="wrap_content"
                  android:layout_width="0dp"
                  android:layout_weight="1"
                  android:text="@string/trading_period_max" /&gt;
  
          &lt;/android.support.design.widget.TabLayout&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>