title: Dynamically set ViewPager height
body: <p>I am trying to put a <code>ViewPager</code> with different fragments with different heights. I know that <code>wrap_content</code> is not working with <code>ViewPager</code> so I am trying to set pager height dinamically.
  I am setting the pager height in a page listener:</p>
  
  <pre><code>...
          indicator.setOnPageChangeListener(new OnPageChangeListener() {
  
              @Override
              public void onPageSelected(int selected) {
                  final View view = fragments[selected].getView();
                  if (view != null) {
                      pager.setLayoutParams(new LayoutParams(
                              LayoutParams.MATCH_PARENT, view
                                      .getMeasuredHeight()));
  
                  }
  
              }
  </code></pre>
  
  <p>Unfortunately it is not working because the value returned by <code>getMeasuredHeight()</code> on <code>Fragment</code> is wrong. What am I doing wrong?</p>