简体   繁体   English

数字键盘和输入类型=“文本”

[英]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.

相关问题 Reactjs 表单验证 - 用于输入类型编号的文本字段即使在从键盘退格后也不断显示单个值 - Reactjs Form Validations-for input type number the text field in constantly showing single value even after giving backspace from the keyboard HTMl输入类型显示第一个数字和可选的字母键盘 - HTMl input type show first number and optional alphabetic keyboard 节目 <Go> 代替 <Next> 在Chrome软键盘中输入类型=“数字” - Show <Go> instead of <Next> in Chrome soft keyboard for input type=“number” Jquery通过上/下箭头键盘增加/减少输入文本中的数字 - Jquery increase/decrease number in input text by up/down arrows keyboard Titanium - iOS上的createAlertDialog,带有数字键盘键盘的secure_text_input? - Titanium - createAlertDialog on iOS with secure_text_input with number pad keyboard? 如何在移动应用程序中显示文本输入字段的数字键盘 - How to show number keyboard for a text input field in mobile application 调用.focus() <input type=“text”> WKWebView中导致键盘滞后 - calling .focus() on <input type=“text”> in WKWebView causes keyboard lag 移动Safari-在输入类型=“文本”上调用辅助键盘 - Mobile Safari - Invoke Secondary Keyboard on input type=“text” 检查输入是否属于“文本/数字/电子邮件/等”类型? - Check if input is of type "text/number/email/etc"? 在输入数字类型时仅在焦点上显示文本 - Display text in input of type number only on focus
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM