Android:关闭软键盘时显示WhiteSpace

时间:2014-05-09 11:53:06

标签: android android-layout android-listview android-edittext android-softkeyboard

我有一个布局,其中包含ListView和ListView下面的EditText,用于在列表视图中搜索。问题是当我在搜索后关闭软键盘时,它会在关闭软键盘时给出一个混蛋并显示空白区域。我尝试过adjustPan,但它会将整个布局向上移动。

enter image description here

1 个答案:

答案 0 :(得分:0)

public static void hideKeyboard(Context context,View v)
    {
        InputMethodManager imm = (InputMethodManager)context.getSystemService(
                  Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(v.getWindowToken(), 0);

    }

希望这有帮助!