Android: Displaying WhiteSpace When Closing Soft Keyboard

六眼飞鱼酱① 提交于 2020-01-03 15:33:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!