The keyboard covers an input field in an Android WebView app when the WebView never learns how much of the screen the keyboard took. Either the app’s window isn’t resized, or the app handles the keyboard’s size itself and passes nothing on. Fix the window settings and the insets in the app, then make the page scroll the focused field into view.
Why the keyboard covers the input in an Android WebView
The keyboard covers an input in an Android WebView because nothing told the page that its visible area shrank. For years, the visual viewport in WebView stayed fixed when the keyboard opened, “often hiding input fields behind the keyboard”. The app had to shrink the WebView itself.
WebView M139 changed that. From that version, the keyboard (Android calls it the IME) directly resizes the visual viewport in all WebViews. The page keeps its layout, and the part you can see gets shorter.
On an old System WebView, the app must still resize its window. On M139 and newer, the WebView handles the keyboard, but only if the app lets the keyboard’s size reach it.
Take a login page in a full-screen app. The user taps the password box near the bottom, the keyboard slides up, and the box is gone behind it. In Chrome, the same page scrolls the box into view.
Check the window’s soft input mode first
The activity’s android:windowSoftInputMode setting decides whether the app’s window makes room for the keyboard. The manifest reference lists four adjust values:
| Value | What the window does |
|---|---|
adjustResize |
Resizes to make room for the keyboard |
adjustPan |
Keeps its size and pans the contents so the focused field stays visible |
adjustUnspecified |
The default. The system chooses |
adjustNothing |
Neither resizes nor pans. The activity must make room using window insets |
Set adjustResize on the activity that holds the WebView. Android’s own keyboard guide recommends that value for the best backward compatibility. It calls panning generally less desirable than resizing, and with a WebView panning often slides the top of your page off screen.
Edge-to-edge and full-screen apps need inset handling
An edge-to-edge app has to deal with the keyboard’s size itself, because the system no longer does it for free. Apps are edge-to-edge by default on devices running Android 15 if the app targets Android 15 (API level 35). The same page warns that parts of the app may be obscured and “you must handle insets”.
So an app that worked for years starts hiding inputs after a target SDK bump. Nothing in the manifest changed, but the window now draws behind the system bars and the keyboard.
In the app’s code, the keyboard’s height comes from insets.getInsets(WindowInsetsCompat.Type.ime()).bottom. You have two choices:
- Let the WebView handle it. On WebView M139 and newer, do nothing with the keyboard inset and let it reach the WebView.
- Pad the parent yourself. Add bottom padding equal to the keyboard height on the WebView’s container.
Doing both gives you double padding. My take: use option 1 and keep padding only for the system bars. It’s less code, and the page then behaves as it does in Chrome.
If you made the WebView app full screen, test every form again.
Don’t consume the insets before the WebView sees them
A WebView can only react to the keyboard if the insets reach it, so a parent view that consumes them breaks the fix. The WebView insets guide says to set the inset types you handled to Insets.NONE instead of returning WindowInsetsCompat.CONSUMED. Consuming can cause “ghost padding”, such as keyboard padding that stays after the keyboard is hidden.
The Chromium notes on WebView insets describe the same trap from the other side. If a handler consumes insets, propagation stops and the WebView keeps old values. And if an app opts out of WebView’s inset handling, “the keyboard may cover inputs near the bottom of the page”.
The guide adds that the WebView should get non-zero insets only when the keyboard overlaps its bounds. If your WebView sits above a native bottom bar, account for that bar.
The keyboard opens and closes again
A keyboard that flashes open and shuts is usually the website’s fault, not the app’s. The insets guide lays out the loop in 4 steps:
- The user focuses an input.
- The keyboard appears, which triggers a resize event.
- The website’s code clears focus in response to the resize.
- The keyboard hides because focus was lost.
It appears after a WebView update, because M139 started sending resize events the page never got before. Find the resize listeners in your JavaScript and make sure none of them call blur() or close a form when the viewport changes.
Fixes you can make on the website
Website-side fixes help when the app can’t be changed, though they can’t replace missing insets.
On focus, call scrollIntoView() on the input. Its block option takes start, center, end or nearest. center keeps the field clear of the keyboard.
Then add bottom padding to your forms. A field at the very bottom of a page that can’t scroll has nowhere to go.
The viewport meta tag won’t help. Chrome 108 added an interactive-widget key with values such as resizes-content and overlays-content, but the announcement says those changes do not affect WebView.
The limitation: if the app swallows the keyboard insets, scrollIntoView() may not work properly either, and no JavaScript fully fixes that.
To see what the page receives, debug the WebView with Chrome DevTools and watch the resize events as the keyboard opens.
Find the cause quickly
| What you see | Likely cause | Fix |
|---|---|---|
| Field hidden on every phone | Window isn’t resized | Set adjustResize |
| Broke after targeting API level 35 | Edge-to-edge, insets not handled | Pass the keyboard inset to the WebView |
| Fine on new phones, hidden on old ones | WebView older than M139 | Pad the WebView’s parent by the keyboard height |
| Keyboard opens, then closes | Page clears focus on resize | Remove blur() from resize handlers |
| Empty gap after the keyboard closes | Insets consumed, ghost padding | Zero the insets instead of consuming them |
For the third row, check which WebView version the phone has. If it’s old, the user can update Android System WebView.
Keyboard behaviour in a Web2Apk app
A Web2Apk app is built from a generic Android template plus your saved settings, so you can’t edit its manifest or add inset code. Web2Apk doesn’t guarantee that every website behaves in the WebView as it does in Chrome. Install the APK on a real phone and type into every form, including the one at the bottom of your longest page.
If a field hides, use the website fixes above. Live website content changes without an app update, so a scrollIntoView() call or extra form padding reaches the app you already shipped. The website to APK guide lists the other WebView differences to test.
FAQ
Does adjustResize fix the keyboard covering inputs in a WebView?
Often, but not always. adjustResize resizes the activity’s window to make room for the keyboard, yet an edge-to-edge app still has to handle the keyboard inset itself or pass it to the WebView.
Why does the keyboard open and then close again in my WebView app?
The keyboard resizes the page, the website’s own code clears focus when it sees the resize, and the keyboard hides because focus was lost. Remove the code that calls blur() on resize.
Which WebView version resizes the page for the keyboard?
WebView M139 added keyboard (IME) inset support for all WebViews. From that version the keyboard resizes the visual viewport, as long as the app doesn’t consume the insets first.
What is the difference between adjustResize and adjustPan?
adjustResize resizes the activity’s main window to make room for the keyboard. adjustPan keeps the window size and pans the contents so the focused field stays visible, which is generally less desirable.
Can I fix a hidden input field from the website alone?
Partly. You can call scrollIntoView() on the focused field and stop clearing focus on resize. If the app swallows the keyboard insets, only a change in the app fully fixes it.
Sources
- Understand window insets in WebView - Android Developers
- Android WebView & Insets - Chromium docs
- Control and animate the software keyboard - Android Developers
- activity manifest element: windowSoftInputMode - Android Developers
- Behavior changes: Apps targeting Android 15 or higher - Android Developers
- Prepare for viewport resize behavior changes coming to Chrome on Android - Chrome for Developers
- Element: scrollIntoView() method - MDN