Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 安卓系统平稳关闭键盘_Android_Android Keypad - Fatal编程技术网

Android 安卓系统平稳关闭键盘

Android 安卓系统平稳关闭键盘,android,android-keypad,Android,Android Keypad,我使用下面的代码从屏幕上隐藏软键盘 InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow( mSearchView.getWindowToken(), 0); 当键盘关闭时,一个白色框出现在覆盖它一小

我使用下面的代码从屏幕上隐藏软键盘

InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        inputMethodManager.hideSoftInputFromWindow(
                mSearchView.getWindowToken(), 0);
当键盘关闭时,一个白色框出现在覆盖它一小段时间的空间中,这可以避免吗?

尝试以下操作:

        InputMethodManager inputMethodManager = (InputMethodManager)  activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
        inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);

问题是我已将清单中活动的WindowsOfInputMode属性设置为adjustResize

你使用的操作系统的版本是什么???@kAnNaN我在android版本2.3到4.4上试过,不确定,但试试这一行
overridePendingTransition(0,0)在您的代码之后。@Kedarnath没有解决问题这并不能解决问题,当软键盘关闭时,仍然会出现一个白色框