Android soft keyboard will hide for no reason

时光总嘲笑我的痴心妄想 提交于 2019-11-28 08:57:02

问题


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!


回答1:


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



来源:https://stackoverflow.com/questions/10522727/android-soft-keyboard-will-hide-for-no-reason

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!