如何显示自定义键盘 [英] How to display a custom keyboard

查看:82
本文介绍了如何显示自定义键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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对此无能为力.(在更糟糕的情况下,您可以

  • http://www.html5rocks.com/zh-CN/tutorials/forms/html5forms/
  • http://danielfriesen.name/blog/2013/09/19/input-type-number-and-ios-numeric-keypad/
  • http://www.wufoo.com/html5/attributes/10-pattern.html
  • Google
  • 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:

    这篇关于如何显示自定义键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆