views:

238

answers:

1

I am opening a facebook login page in WebView when user select login field soft keyboard appears. I would like to have a done key button on the soft keyboard, how to do it?

I know we can add the done button by the following code attached with edit field

ediText.setImeOptions(EditorInfo.IME_ACTION_DONE);

But it is HTML form in WebView any clue how to do that?

+1  A: 

Because you have no control over the website being shown in the WebView, you are unable to change the type of keyboard that is appearing.

My tests indicate that Android devices will show a "Next" button for every <input type="text" /> or <input type="password" /> field on a website and a "Go" or "Done" button for the last element on the page. If there were some html or css property that could be used to force a different type of keyboard, then you could enable JavaScript in your WebView and execute a JavaScript pseudo url to alter the facebook page's input elements;

WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.loadUrl("javascript://getElement('signinbox').style.someCssClass='someKeyboardProperty';");

However as stated above, I am unaware of any html/css tag that specifies this. Hope this helps!