【发布时间】:2012-01-20 08:58:09
【问题描述】:
我试图从 InputMethodService 中隐藏我的软键盘,但它不起作用。这是我在 onFinishInput() 方法中使用的代码:
InputMethodManager im = (InputMethodManager)
context.getSystemService(Context.INPUT_METHOD_SERVICE);
im.hideSoftInputFromWindow(mInputView.getWindowToken(), 0);
有什么想法吗?
【问题讨论】:
-
不同之处在于我是从 InputMethodService 调用它 - 而不是 Activity
-
@hsnepen,嗯?您正在 InputMethodManager 上调用 hideSoftInputFromWindow。这个调用大概是在 Activity 内部进行的。哦,这肯定是重复的:stackoverflow.com/questions/1109022/…
-
我正在扩展 InputMethodService - 而不是 Activity。这不是从 Activity 内部调用的。它在服务的扩展中被调用。
标签: android android-input-method