问题
I have a layout which contains a ListView and a EditText below the ListView which is used for searching in list view. The problem is that when i close the soft keyboard after a search, it gives a jerk and shows white space while closing the soft keyboard. I have tried adjustPan, but it moves the whole layout up.
回答1:
public static void hideKeyboard(Context context,View v)
{
InputMethodManager imm = (InputMethodManager)context.getSystemService(
Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
Hope this helps!
来源:https://stackoverflow.com/questions/23563949/android-displaying-whitespace-when-closing-soft-keyboard