title: Keyboard hides content in fragment, I need the frame layout to resize so bottom is just above the keyboard and now scrollable
body: <p>I have a fragment in my app that has a scroll view for the signup and login pages. Right now there isn't enough content in the scroll view to actually make it scroll, however when the keyboard appears, it does cover up most of the content in the view. This causes a lot of issues especially on devices with smaller screens, it blocks a lot, and the view is NOT scrollable, so I have to close the keyboard to get to the rest of the inputs.</p>
  
  <p>I need the bottom of the fragments frame layout to be pushed up to JUST above the top of the keyboard, so the keyboard won't actually hide any content, and still allow the scroll view to actually scroll to the rest of the content.</p>
  
  <p>I have seen the usual fix to an issue similar to this, which would to change the <strong>AndroidManifest.xml</strong> to the following:</p>
  
  <pre><code>android:windowSoftInputMode="adjustResize"
  </code></pre>
  
  <p>but this will push up the entire page, which includes the footer view I have under and outside of the login and signup fragment layouts. It makes my scrollview smaller and allows for it to scroll, but I need the footer to stay hidden under the keyboard still.</p>
  
  <p>I think a work around to this would be to have override onConfigurationChanged(); in MyActivity that will detect if the keyboard has appeared, and if it has, push the bottom of the framelayout to be JUST above the keyboard, thus making the scroll view smaller, and allowing us to actually scroll. I am not quite sure HOW to do this though. </p>
  
  <p>Here is what it looks like with the keyboard up, blocking the content. This would be okay IF the scroll view was scrollable, allowing me to see the rest of the content, however it will not scroll and the only way to access the content under it is to close the keyboard first.</p>
  
  <p><strong>EDIT</strong>
  I was able to use the answer below, editing the Android manifest for</p>
  
  <pre><code>android:windowSoftInputMode="adjustResize"
  </code></pre>
  
  <p>and the first method using the code below</p>
  
  <pre><code>final View activityRootView = findViewById(R.id.activityRoot);
  activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
      @Override
      public void onGlobalLayout() {
          int heightDiff = activityRootView.getRootView().getHeight() - activityRootView.getHeight();
          if (heightDiff &gt; 100) { // if more than 100 pixels, its probably a keyboard...
              ... do something here
          }
       }
  });
  </code></pre>
  
  <p>I had it adjust my views so the footer would be pushed way down below, then resize the layout holding the fragment to extend down allowing it to be scrollable still.</p>