我知道该功能用于切换软输入,根据文档。但我对作为参数传递的标志如何工作感到困惑。任何一个例子都是可观的(我也想要解释,以便我得到确切的功能)。谢谢!
答案 0 :(得分:-1)
显示软键盘 -
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
if(imm != null){
imm.toggleSoftInput(0, InputMethodManager.SHOW_IMPLICIT);
}
隐藏SoftKeyboard -
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
if(imm != null){
imm.toggleSoftInput(0, InputMethodManager.HIDE_IMPLICIT_ONLY);
}