我有一个DrawerLayout,我用它作为滑动菜单,现在我使用InputMethodManager关闭键盘,当显示DrawerLayout时。
public void onDrawerOpened(View drawerView) {
supportInvalidateOptionsMenu();
// Hide Soft-Keyboard
InputMethodManager imm = (InputMethodManager) MainActivity.this.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(drawerView.getApplicationWindowToken(), 0);
}是否有任何保持软键盘打开并在上面显示DrawerLayout的方法?那么,当抽屉布局关闭时,活动/软键盘仍然处于相同的状态?
谢谢。
发布于 2014-04-07 11:21:07
我想这是不可能的。但你可以try..there也许是一种方法。但我的想法是,当抽屉打开和关闭时,隐藏并显示键盘,这可能是可能的,而不是你的想法。
发布于 2014-04-07 10:32:41
试试下面的代码:
((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput
(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);https://stackoverflow.com/questions/22909785
复制相似问题