Android: how to add custom soft keyboard when form field is selected in WebView

流过昼夜 提交于 2019-12-21 12:22:07

问题


I am using WebView to present UI. Is there any way that I can trigger custom soft keyboard when input text form field is selected?


回答1:


I just encounter a similar problem with the android WebView. When I select, in touch mode, a text input field, it does not pop-up the virtual keyboard whereas with the trackball it works fine.

I just found there: http://groups.google.com/group/android-developers/browse_thread/thread/e52109afda599301/b4cbc16e4e9e8e0d (last message from alien9) that calling

myWebview.requestFocusFromTouch(); 

solve the problem.




回答2:


take a look at HTML5 - if you change your

<input type="text" ...

to for instance a

<input type="number" ...

you'll get a specialized soft keyboard for numbers.

Here is some more documentation: http://diveintohtml5.ep.io/forms.html



来源:https://stackoverflow.com/questions/3098186/android-how-to-add-custom-soft-keyboard-when-form-field-is-selected-in-webview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!