简体   繁体   English

Android:如何在WebView中选择表单字段时添加自定义软键盘

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

I am using WebView to present UI. 我正在使用WebView来呈现UI。 Is there any way that I can trigger custom soft keyboard when input text form field is selected? 有没有什么办法可以在选择输入文本表单字段时触发自定义软键盘?

I just encounter a similar problem with the android WebView. 我刚刚遇到了与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 我刚刚在那里找到: http ://groups.google.com/group/android-developers/browse_thread/thread/e52109afda599301/b4cbc16e4e9e8e0d(来自alien9的最后一条消息)

myWebview.requestFocusFromTouch(); 

solve the problem. 解决这个问题。

take a look at HTML5 - if you change your 看看HTML5 - 如果你改变你的

<input type="text" ...

to for instance a 例如a

<input type="number" ...

you'll get a specialized soft keyboard for numbers. 你会得到一个专门的数字软键盘。

Here is some more documentation: http://diveintohtml5.ep.io/forms.html 这是一些更多的文档: http//diveintohtml5.ep.io/forms.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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