简体   繁体   English

Android输入法管理器只获取数字键盘

[英]Android Input Method Manager to get Numbers only keypad

We use 我们用

InputMethodManager imPharamcy = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imPharamcy .toggleSoftInput(0, InputMethodManager.SHOW_IMPLICIT);

to get the keyboard forcefully. 强有力地获得键盘。 But the keyboard is not numbers only keyboard. 但键盘不是数字键盘。 How do i get numbers only keyboard using inputMethod Manager. 如何使用inputMethod Manager获取仅数字键盘。

In xml i have already given 在我已经给出的xml中

   android:inputType="phone"
   android:imeOptions="actionNext"              

the editText takes numbers only Strangely in the emulator a number only keypad comes up but on a phone numbers and special charaters keypad comes editText仅采用数字奇怪的是在模拟器中只有一个数字键盘出现但是在电话号码和特殊的字符键盘上来了

See below code: 见下面的代码:

    // 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);

Hope you got the point. 希望你明白这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM