当用户单击按钮时,我试图使用以下代码隐藏软键盘:
InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);但我发现了一个错误:
InputMethodManager未定义
我在想我需要添加一个导入语句吗?如果是的话,有人知道吗?或者我该怎么解决这个问题?
发布于 2012-03-29 17:51:11
InputMethodManager在包android.view.inputmethod中,所以您需要添加
import android.view.inputmethod.InputMethodManager;敬你的班级。
https://stackoverflow.com/questions/9930608
复制相似问题