在输入法服务中隐藏软键盘

cod*_*der 2 android android-input-method

我正在尝试从InputMethodService隐藏我的软键盘,并且无法正常工作。这是我在onFinishInput()方法中使用的代码:

InputMethodManager im = (InputMethodManager)
context.getSystemService(Context.INPUT_METHOD_SERVICE);
im.hideSoftInputFromWindow(mInputView.getWindowToken(), 0);
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

小智 6

以下对我有用:

requestHideSelf(0);

mInputView.closing();
Run Code Online (Sandbox Code Playgroud)