Android软键盘会无故隐藏

时间:2023-01-31
本文介绍了Android软键盘会无故隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我遇到以下问题 - 我已放置

I'm having the following issue - I have placed

android:windowSoftInputMode = "stateAlwaysVisible"

在我的清单中,由于软件键盘几乎始终可见,因此效果相对较好.我有一个 webview,其中有一个可编辑的 div,用户可以在其中输入文本.但是,当用户输入一些文本并在 webview 上的其他位置(在与当前光标位置不同的位置)点击时,软件键盘将隐藏片刻,然后重新出现.我束手无策,找不到对此的解释.使用 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软键盘会无故隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:Android 键盘 - 开始小写 下一篇:在 iOS 8 中呈现隐藏键盘时编辑 UIView 的边界

相关文章

最新文章