At some point, you need to force the hidden Android input keyboard, such as the current keyboard is being displayed, this time click on the side Slide panel. You must force the keyboard to hide the IME.
Common methods on the Internet are:
1,inputmethodmanager imm = (Inputmethodmanager) getactivity ()
. Getsystemservice (Context.input_method_service);
Imm.togglesoftinput (0, inputmethodmanager.hide_not_always);
This is to let the IME state reversal, assuming that the current is not displayed is displayed.
If it is displayed, it is hidden. Therefore, it does not conform to the application scenario described in this article.
2, Imm.hidesoftinputfrominputmethod (Passwdedit.getwindowtoken (), 0);
This by myself on the android4.2 machine test invalid.
3, Imm.hidesoftinputfrominputmethod (Getactivity (). Getcurrentfocus (). Getwindowtoken (), 0);
After I test, still invalid. Grandpa's. For this small function wasted Zajia two hour time.
4,Imm.hidesoftinputfromwindow (Passwdedit.getwindowtoken (), 0);
After testing, this is the only effective method.
In addition, it was said that:
Inputmethodmanager IMM = (Inputmethodmanager) This
. Getsystemservice (Context.input_method_service);
Boolean isopen=imm.isactive ();
LOG.I (TAG, "imm.isactive () =" + IsOpen);
Use the above code to infer whether the current input keyboard pop-up is visible. Totally ridiculous. IsOpen is always true.
Hereby record.
Android hidden input keyboard (Hidesoftinputfrominputmethod no effect)