How can I detect that the telephone does not have hardware keyboard and only in that case to force showing the virtual one? And how can I hide it?
I tried putting the focus like this but it doesn't work:
View exampleView = (View)findViewById(R.id.exampleBox);
exampleView.requestFocus();
If I force like this the virtual keyboard, the keyboard will appear also when a hardware keyboard is available, which doesn't make sense.
InputMethodManager inputMgr = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
inputMgr.toggleSoftInput(0, 0);
And last but not least, how can I show directly the numerical or phone keyboard? (Not the normal keyboard)
Any idea?
Thanks!
我会说使用Configuration类hardKeyboardHidden来查看硬键盘是否已经关闭,如果没有,则打开软键盘
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.