title: ViewPager not working with match_parent
body: <p>I have a base activity which has <code>AppBarLayout</code> with a <code>toolbar</code> and <code>tablayout</code>. There is a <code>bottombar</code> with <code>contentframe</code> to load the fragment. Now there is a fragment with which has a <code>viewpager</code> which will load the fragments of the selected tab.</p>
  
  <p>Now the problem is that whenever I am loading the fragment in the<code>viewpager</code>, the height of the <code>viewpager</code> is <code>0</code>. I am not able to see the loaded fragment.</p>
  
  <p>If I specify height like <code>400dp</code> or so to the <code>viewpager</code> then it is visible and works properly.</p>
  
  <p>Toolbar xml: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;merge 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="wrap_content"&gt;
  
      &lt;android.support.design.widget.AppBarLayout
          android:id="@+id/appbarlayout"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:theme="@style/AppTheme.AppBarOverlay"&gt;
  
          &lt;android.support.v7.widget.Toolbar
              android:id="@+id/toolbar"
              android:layout_width="match_parent"
              android:layout_height="?attr/actionBarSize"
              android:background="?attr/colorPrimary"
              app:popupTheme="@style/AppTheme.PopupOverlay"
              app:layout_scrollFlags="scroll|enterAlways"/&gt;
      &lt;/android.support.design.widget.AppBarLayout&gt;
  &lt;/merge&gt;
  </code></pre>
  
  <p>Activity xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/activity_job_landing"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      tools:context=".xxx.xxxx.xxxx"&gt;
  
      &lt;include
          layout="@layout/layout_app_bar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content" /&gt;
  
      &lt;android.support.v4.widget.NestedScrollView
          android:id="@+id/myScrollingContent"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          app:layout_behavior="@string/appbar_scrolling_view_behavior"&gt;
  
          &lt;FrameLayout
              android:id="@+id/framelayout_joblanding_contentframe"
              android:layout_width="match_parent"
              android:layout_height="match_parent" /&gt;
      &lt;/android.support.v4.widget.NestedScrollView&gt;
  
      &lt;com.roughike.bottombar.BottomBar
          android:id="@+id/bottom_bar_job_landing"
          android:layout_width="match_parent"
          android:layout_height="60dp"
          android:layout_gravity="bottom"
          android:background="@color/indigo900"
          app:bb_activeTabAlpha="1"
          app:bb_activeTabColor="@color/white"
          app:bb_behavior="shy"
          app:bb_inActiveTabAlpha="0.8"
          app:bb_inActiveTabColor="#B6BDBF"
          app:bb_tabXmlResource="@xml/job_landing_bottom_bar_tabs" /&gt;
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>Fragment xml:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical"
          tools:context="com.xxx.xxxx.xxx"
          android:background="@color/bluegrey50"&gt;
  
          &lt;android.support.v4.view.ViewPager
              android:id="@+id/viewpager_job_applicant"
              android:layout_width="match_parent"
              android:layout_height="match_parent"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Fragment Java:</p>
  
  <pre><code>public class ApplicantFragment extends Fragment {
  
      @BindView(R.id.viewpager_job_applicant)
      ViewPager mViewPager;
  
      //@BindView(R.id.tab_layout_job_applicant)
      TabLayout mTabLayout;
  
      public ApplicantFragment() {
          // Required empty public constructor
      }
  
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState)
      {
          // Inflate the layout for this fragment
          View view = inflater.inflate(R.layout.fragment_applicant, container, false);
  
          ButterKnife.bind(this, view);
  
          mTabLayout = (TabLayout) getActivity().findViewById(R.id.tab_layout_job_applicant);
          mViewPager.setAdapter(new ApplicantFragmentPagerAdapter(getChildFragmentManager()));
          mTabLayout.setupWithViewPager(mViewPager);
          return view;
      }
  
  
      class ApplicantFragmentPagerAdapter extends FragmentPagerAdapter {
          final int PAGE_COUNT = 7;
          private final String tabTitles[] =
                  new String[]{"Fresher", "Next Round", "Hold",
                          "Reject", "TCFI", "CFI", "Hired"};
  
          public ApplicantFragmentPagerAdapter(FragmentManager fm) {
              super(fm);
          }
  
          @Override
          public Fragment getItem(int position) {
  
              CandidateListFragment candidateListFragment;
              candidateListFragment = CandidateListFragment.newInstance();
              return candidateListFragment;
          }
  
          @Override
          public int getCount() {
              return tabTitles.length;
          }
  
          @Override
          public CharSequence getPageTitle(int position) {
              // Generate title based on item position
              return tabTitles[position];
          }
      }
  }
  </code></pre>
  
  <p>Fragment that is loaded:</p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="xxx.xxxx.xxxx"&gt;
  
      &lt;!-- TODO: Update blank fragment layout --&gt;
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:text="@string/hello_blank_fragment" /&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>