在HTML5 iOS 7/iOS 8中显示十进制键盘 [英] Show Decimal Keyboard in HTML5 iOS 7 / iOS 8
问题描述
现在搜索了几个小时之后,我只是有一个简单的问题:是否有可能在webbrowsers输入字段中显示小数键盘? input type="number"
仅显示数字,但是我需要在左下角使用逗号或点.
I just have a simple question after having searched for hours now: Is there any possibility to show the decimal keyboard in webbrowsers input fields? input type="number"
only shows numbers but i need a comma or dot instead in the bottom left corner.
我尝试了任何操作,例如pattern
,step
等,但都没有出现十进制键盘.我只需要数字和点或逗号,不需要A-Z或a-z或其他任何内容.
I tried anything, pattern
, step
etc., but nothing brings up the decimal keyboard. I only need the numbers and a dot or comma, no A-Z or a-z or anything else.
<input type="number" id="inputNumbers" pattern="[0-9]*" size="30" min="1" max="5">
这就是我得到的:
这就是我想要的:
推荐答案
尝试一下:
EditText myEditText = (EditText)findViewById(R.id.myEditText);
myEditText.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL);
或者:
<input type="tel" />
这有点骇人听闻
<input type="number" step="0.01">
能否正常工作取决于您在输入值时要达到的目标
Might work depending on what you are trying to achieve when it comes to input values
此链接可能有用: 使用自定义/货币模式的强制iOS数字键盘
希望你说对了!
这篇关于在HTML5 iOS 7/iOS 8中显示十进制键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!