I have a WebView (within a Fragment within a ViewPager with SlidingTabLayout).
When using the WebView to type, I want the layout to resize to make sure the input is visible.
When I click a text input in the WebView, the softkeyboard appears and the layout resizes. I'm able to enter my text and submit using the softkeyboard's return button or cancel input using the back button. After this, the keyboard disappears and the layout resizes back. Correct AdjustResize
behavior.
However, when dismissing the keyboard by clicking outside the Softkeyboard (e.g. when entering a query in Google and pressing the Search button in the WebView) the keyboards hides and it takes about 2-3 seconds for the layout to resize (leaving a blank space for 2-3 seconds at the bottom of my layout). After that, when selecting the textinput, the keyboard overlays the WebView (adjustPan).
How can I make sure that when dismissing the keyboard by pressing the WebView, adjustResize
behavior is maintained.
I've tried re-setting AdjustResize (e.g. from onTouch) but this has no effect:
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
I've also tried the following solution but this gives no change.
In addition, I've think this is probably not a focus issue (since the keyboard does appear, and the webview does respond). And I do ask focus from my View:
webView.setFocusable(true);
webView.setFocusableInTouchMode(true);