我怎样才能默认为上一个EditText视图的重点在数字小键盘? [英] How can I default to the numeric keypad on focus of an EditText view?
本文介绍了我怎样才能默认为上一个EditText视图的重点在数字小键盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有供用户在磅输入他们的体重一个EditText字段。我如何可以覆盖传统的键盘和显示数字小键盘呢?
I have an EditText field for the user to enter their weight in lbs. How can I override the traditional keyboard and display the numeric keypad instead?
推荐答案
这并没有为我工作。不过,我可以通过以下行来完成上述
This didn't work for me. However, I was able to accomplish the aforementioned by either of the following lines:
// TYPE_CLASS_NUMBER: Class for numeric text. This displays the numbers/symbols keyboard.
editText.setInputType(InputType.TYPE_CLASS_NUMBER);
// TYPE_CLASS_PHONE: Class for a phone number. This displays the phone number keypad.
editText.setInputType(InputType.TYPE_CLASS_PHONE);
这篇关于我怎样才能默认为上一个EditText视图的重点在数字小键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文