Android软键盘会无缘无故隐藏 [英] Android soft keyboard will hide for no reason
问题描述
我遇到了以下问题 - 我已经放置
I'm having the following issue - I have placed
android:windowSoftInputMode = "stateAlwaysVisible"
在我的清单中工作相对良好,因为软件键盘几乎总是可见的.我有一个 webview,其中有一个可编辑的 div,用户可以在其中输入文本.但是,当用户输入一些文本并点击 web 视图上的其他位置(与当前光标位置不同的位置)时,软件键盘将隐藏片刻,然后重新出现.我不知所措,找不到对此的解释.使用 InputMethodManager 使键盘始终可见也无济于事.
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!
推荐答案
问题是由于我们通过 loadUrl("javascript : bar(event.getX(), event.getY()));"
.
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()));"
.
结果 loadUrl
方法在内部隐藏了软件键盘.我通过不将触摸事件传递给 javascript 来解决这个问题,而是使用 window.onmousemove
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
这篇关于Android软键盘会无缘无故隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!