您的位置:首页 > 移动开发 > Android开发

【Android】 手动显示和隐藏软键盘

2014-06-09 16:25 323 查看
public class InputMethodUtil {
private static InputMethodUtil instance;

public static InputMethodUtil getInstance() {
if (instance == null)
instance = new InputMethodUtil();
return instance;
}

public void hideInputMethod(Context context, View view) {
((InputMethodManager) context.getSystemService(context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(view.getWindowToken(), 0);
}

public void showInputMethod(Context context, View view) {
((InputMethodManager) context.getSystemService(context.INPUT_METHOD_SERVICE)).showSoftInput(view, 0);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: