简体   繁体   中英

Can't type inside a WebView

I have a problem interacting with a WebView . I'm showing an HTML login form within a WebView and I can't type inside of any of the input fields of the forms. I do can interact with the links, select boxes, buttons, etc.

Here is an example of my code. Basically I'm retrieving the web view from the xml and setting it a WebViewClient and a WebChromeClient .

webview = (WebView) findViewById(R.id.loginWebview);
webview.getSettings().setJavaScriptEnabled(true);

WebViewClient client = new WebViewClient();
webview.setWebViewClient(client);

webview.setWebChromeClient(new WebChromeClient());
webview.loadUrl("http://www.google.com");

Any ideas?

You can do the following to solve this:

WebView webView = (WebView)findViewById(R.id.yourWebView);
webView.getSettings().setJavaScriptEnabled(true);
webView.requestFocus(View.FOCUS_DOWN);

There is another post here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM