简体   繁体   English

Android-显示不带EditText的数字键盘

[英]Android - Show numeric keyboard without an EditText

For my Android app I need to show numeric keyboard when the user clicks on an image, but without showing an EditText. 对于我的Android应用程序,我需要在用户单击图像时显示数字键盘,但不显示EditText。 I want to then be notified when the user pressed a specific key, so that I can handle UI appropiately. 然后,我想在用户按下特定键时得到通知,以便我可以适当地处理UI。

How could it be done? 怎么做? Thank you 谢谢

Try this... 尝试这个...

InputMethodManager inputMethodManager =  (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInputFromWindow(imageview_reference.getApplicationWindowToken(),     InputMethodManager.SHOW_FORCED, 0);

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

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