如何显示自定义键盘 [英] How to display a custom keyboard
问题描述
我正在使用Dojo创建一个基于Worklight 6.1的应用程序.
我想向用户展示10键键盘,而不是标准的OS键盘.我将如何去做呢?
我尝试了以下操作,但是它没有调出仅数字键盘.在iOS中,它仅显示具有数字和$%^& *键的视图,才会显示完整的键盘.
< input type ='number'data-dojo-type ='dojox.mobile.TextBox'>
有什么建议吗?
要成功显示数字键盘,您需要将 pattern
属性添加到 input
元素,例如所以:
<输入数据-dojo-type ="dojox.mobile.TextBox" type ="number" pattern ="\ d *">
我没有Android设备,但它也应该可以在其中运行.
请注意,与只有一个键盘的iOS不同,在Android中,用户可以安装自定义键盘,并且可能不是所有的键盘都支持全部可用的可定制性...
Worklight对此无能为力.(在更糟糕的情况下,您可以
I am creating a Worklight 6.1-based app with Dojo.
I want to present a 10-key keyboard to the user instead of the standard OS keyboard. How would I go about doing this?
I've tried the following, but it does not bring up a numbers-only keyboard. In iOS it brings up the full keyboard, only with the view that has numbers and $%^&* keys.
<input type='number' data-dojo-type='dojox.mobile.TextBox'>
Any suggestions?
To successfully display a numeric keyboard you need to add the pattern
attribute to the input
element, like so:
<input data-dojo-type="dojox.mobile.TextBox" type="number" pattern="\d*">
I do not have an Android device, but it should work there as well.
Note that unlike in iOS where there is only 1 keyboard, in Android a user can install custom keyboard and it could be that not all keyboards will support the full set of customizability available...
There is nothing Worklight can do about that. (Worse case scenario you can write a Cordova plug-in to create a custom keyboard of your own, but it's unlikely you'll need to do that).
Here is how it looks like:
Here is some more reading materials on customizing a keyboard:
- http://bradfrostweb.com/blog/mobile/better-numerical-inputs-for-mobile-forms/
- http://www.html5rocks.com/en/tutorials/forms/html5forms/
- https://about.zoosk.com/en/engineering-blog/mobile-web-design-use-html5-to-trigger-the-appropriate-keyboard-for-form-inputs/
- http://danielfriesen.name/blog/2013/09/19/input-type-number-and-ios-numeric-keypad/
- http://www.wufoo.com/html5/attributes/10-pattern.html
这篇关于如何显示自定义键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!