[英]Number Keyboard and input type=“text”
Does anyone knows how to show automatically the number keyboard on input type="text"
on touch devices? 有谁知道如何在触摸设备上的
input type="text"
上自动显示数字键盘?
I can't use input type="number"
because of german number format with dots and commas like 1.000.000,00 我无法使用
input type="number"
因为带有点和逗号的德国数字格式(如1.000.000,00)
It's for the javascript tool heizkostenrechner.eu and there are so many input fields and a solution would improve the usability very much. 它是针对javascript工具heizkostenrechner.eu的,并且有很多输入字段,解决方案可以极大地提高可用性。
to set the EditText
characters 设置
EditText
字符
yourEditText.setInputType(InputType.TYPE_CLASS_NUMBER);
you can use class with a flag to create decimal like: 您可以使用带有标志的类来创建小数,例如:
yourEditText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
but it wont add ',' to it 但不会在其中加上','
check Input Types for more information about types of flags and classes 检查输入类型以获取有关标志和类类型的更多信息
however if you want to add numbers and ',' and '.' 但是,如果要添加数字以及“,”和“。” you can use this code
您可以使用此代码
yourEditText.setKeyListener(DigitsKeyListener.getInstance("0123456789.,"));
this will allow 0123456789 and '.' 这将允许0123456789和'。' and ',' and you can add more characters if you want.
和',',并且您可以根据需要添加更多字符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.