我创建了自己的WebView,并设置WebChromeClient和WebViewClient对象。当我开始这样的WebView的HTML表单域反应过来的时候我接触他们(光标出现),但他们没有获选,也没有软键盘启动。如果我使用轨迹球选择的形式和preSS它,键盘不会出现。
I created my own WebView and set the WebChromeClient and WebViewClient objects. When I start this WebView, the HTML form fields react when I touch them (a cursor appears), but they do not get selected, nor does the soft keyboard start. If I use the trackball to choose the form and press it, the keyboard does appear.
我试着打电话 myWebview.requestFocusFromTouch()
的this回答建议,但它返回false,并没有帮助。
I tried to call myWebview.requestFocusFromTouch()
as this answer suggested, but it returns false and doesn't help.
http://$c$c.google.com/p/android/issues/detail?id=7189
下面是在其他情况下的修补程序不明确。
Here is a fix in case other were not clear.
webview.requestFocus(View.FOCUS_DOWN);
webview.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_UP:
if (!v.hasFocus()) {
v.requestFocus();
}
break;
}
return false;
}
});