我刚开始接触安卓
在一个应用程序中,我正在使用editText,它的最大文本长度为2
这是我的问题
在输入两个字符后(即)当editText达到最大文本长度时,它应该自动隐藏软键盘
有人能说一下怎么做吗?这可能吗?
我在stackoverflow上找到了一些答案,如下:
InputMethodManager inputManager =
(InputMethodManager) context.
getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(
this.getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
这是否足够?或者我在编码过程中需要做一些额外的事情吗? 谢谢