[英]Open Android numeric keyboard programmatically
如何以编程方式打开Android的数字键盘?
我知道如何将EditText设置为数字并启动数字键盘,但是我想要一个没有EditText或Layout的解决方案,因为我正试图为Webview打开键盘。
你尝试过这个吗?
InputMethodManager inputMethodManager =
(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInputFromWindow(linearLayout.getApplicationWindowToken(),
InputMethodManager.SHOW_FORCED, 0);
这到你的oncreate()
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
尝试这个
EditText etxt = new EditText(this);
etxt.setInputType(InputType.TYPE_CLASS_NUMBER);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.