Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android HTML form 'done' button sofkeyboard

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?

like image 479
d-man Avatar asked Jul 27 '10 04:07

d-man


1 Answers

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!

like image 105
aaronsnoswell Avatar answered Oct 22 '22 17:10

aaronsnoswell