Search code examples
androidwebviewkeyboardvisible

Android soft keyboard will hide for no reason


I'm having the following issue - I have placed

android:windowSoftInputMode = "stateAlwaysVisible"

in my manifest which works relatively fine since the software keyboard is almost always visible. I have a webview in which I have an editable div in which the user can enter text. However when the user have entered some text and taps somewhere else on the webview(on a position different from the current cursor position) the software keyboard will hide for a moment and afterwards reappear. I'm at my wits end and can't find an explanation for this. Using InputMethodManager to make the keyboard always visible also didn't help.

Any help will be greatly appereciated. Thanks!


Solution

  • The issue was that the keyboard is hiding due to the fact that we were passing all the touch events down to javascript we are having via loadUrl("javascript : bar(event.getX(), event.getY()));".

    Turns out the loadUrl method internally hides the software keyboard. I worked this around by not passing the touch events to the javascript, but instead by using window.onmousemove