title: How to resize programmatically ViewPager?
body: <p>I have in my layout a ViewPager which I would like to update the height programmatically with the height of my keyboard.</p>
  <p>I've already tried to change the height with LayoutParams but there is not effect.</p>
  <p>I've tried with the code below:</p>
  <pre><code>fun onKeyboardHeightChanged(keyboardHeight: Int) {
     if (keyboardHeight &gt; 0) {
        view_pager?.let {
           val params = it.layoutParams
           params.height = keyboardHeight
           it.layoutParams = params
        }
     }
  }
  </code></pre>
  <p>I've also tried with <code>requestLayout() </code> on the ViewPager but not effect either.</p>
  <p>Thank you for your answers and your help.</p>
  <p><strong>EDIT:</strong></p>
  <p>I've also tried to resize another view than the viewpager and it doesn't work either.
  It seems the only time I can resize views is in <code>onCreateView()</code> or <code>onViewCreated()</code></p>
  <p><em><strong>EDIT 2:</strong></em></p>
  <p>I've found the source of all my problems: functions <code>showKeyboard()</code>and <code>hideKeyboard()</code> which are called in my fragment. When I call these functions, I can't edit the layout of my fragment and his component.</p>
  <p>Above code for these functions:</p>
  <p><strong>Hide Keyboard</strong></p>
  <pre><code>fun Fragment.hideKeyboard() {
      val imm = context?.getSystemService(Activity.INPUT_METHOD_SERVICE) as? InputMethodManager
      view?.let {
          imm?.hideSoftInputFromWindow(it.windowToken, 0)
      }
  }
  </code></pre>
  <p><strong>Show Keyboard</strong></p>
  <pre><code>fun Fragment.showKeyboard() {
      val imm = context?.getSystemService(Activity.INPUT_METHOD_SERVICE) as? InputMethodManager
      imm?.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0)
  }
  </code></pre>