我有一个布局,其中包含ListView和ListView下面的EditText,用于在列表视图中搜索。问题是当我在搜索后关闭软键盘时,它会在关闭软键盘时给出一个混蛋并显示空白区域。我尝试过adjustPan,但它会将整个布局向上移动。
答案 0 :(得分:0)
public static void hideKeyboard(Context context,View v)
{
InputMethodManager imm = (InputMethodManager)context.getSystemService(
Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
希望这有帮助!