//调用隐藏系统默认

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE | WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

//设置控件属性:

android:fitsSystemWindows="true"

显示键盘

public void showInput(EditText editText) {    editText.requestFocus();    InputMethodManager imm = (InputMethodManager)    getSystemService(INPUT_METHOD_SERVICE);    imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);}

隐藏键盘

public void hideInput() {    InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);    View v = getWindow().peekDecorView();    if (null != v) {        //强制隐藏键盘         imm.hideSoftInputFromWindow(v.getWindowToken(), 0);    }}

获取打开的状态

public boolean getIsOpen() {    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);    return imm.isActive();}

更多相关文章

  1. android 自带的下拉刷新控件,含Demo(SwipeRefreshLayout控件)
  2. Android(安卓)动态设置控件高度
  3. Android的GridView控件点击图片变暗效果
  4. android 自带的下拉刷新控件,含Demo(SwipeRefreshLayout控件)
  5. android 控件跟随手指移动,类似捕鱼达人效果
  6. android performClick
  7. android 应用程序 集合
  8. android 关闭软键盘
  9. Android(安卓)反射获得控件对象

随机推荐

  1. linearLayout 和 relativeLayout的属性区
  2. 【android】android使用命令模拟按键
  3. Android UI控件学习笔记(二)
  4. 添加 C/C++ 代码
  5. android中系统自带样式
  6. Android(安卓)开发学习资料
  7. Android 实例子源代码文件下载地址380个
  8. Android基本控件常用属性及方法
  9. android facebook authorize 时禁止调用f
  10. Android之Android(安卓)Studio JNI