[英]How to call number keyboard automatically?
I'm beginner in Java Android developing. 我是Java Android开发的初学者。 I'm using Eclipse SDK 3.6.1 version.
我正在使用Eclipse SDK 3.6.1版本。 I'm trying to do this thing: when I start my application it calling to input a pin code, but if you want to input a number you have to click on the pin field.
我正在尝试做这件事:当我启动应用程序时,它会调用输入密码,但是如果您想输入数字,则必须单击密码字段。 How to call number keyboard automatically?
如何自动拨打数字键盘? I'm using Samsung gt-i5500, it's touchscreen.
我正在使用三星gt-i5500,它是触摸屏。
我实际上没有尝试过,但是您可以尝试在pin字段上设置android:inputType="phone"
,然后在代码中的该字段上调用requestFocus
。
You just have to set android:inputType="number"
for your pin editText as below: 您只需要为pin editText设置
android:inputType="number"
,如下所示:
<EditText
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:inputType="number"
></EditText>
And a numeric keyboard will be shown when user clik on the field. 用户点击该字段时,将显示数字键盘。
You can tell the UI (specifically the TextView:EditText) what type of field you are dealing with by setting the inputType. 您可以通过设置inputType来告诉UI(特别是TextView:EditText)要处理的字段类型。 Here are a list of the available input types , and, depending on what you choose, you'll receive that keyboard when you enter data into the field.
这是可用输入类型的列表 ,根据您选择的内容,在字段中输入数据时,您会收到该键盘。
In your case, you're most likely going to want inputType:number. 在您的情况下,您最有可能需要inputType:number。 See the link I provided for the entire list of available options.
有关可用选项的完整列表,请参见我提供的链接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.