1) 如果一定要隐藏使用如下方法:

InputMethodManager imm = (InputMethodManager)

leftBtn.getContext().getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(leftBtn.getWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS);

其中LeftBtn是该布局中某个控件,hideSoftInputFromWindow()方法就是隐藏软键盘。

2) 如果需要切换软键盘,就是原来没有弹出软件盘时去显示软键盘;原来有软键盘弹出时就去隐藏软件盘,代码如下:

InputMethodManager imm=(InputMethodManager)

leftBtn.getContext().getSystemService(INPUT_METHOD_SERVICE);

imm.toggleSoftInput(1, InputMethodManager.HIDE_NOT_ALWAYS);

更多相关文章

  1. Android实现布局全屏
  2. git新建本地仓库关联远程仓库(无需移动本地仓库文件)
  3. 隐藏android WebView 高亮选择框
  4. 改变 Android(安卓)EditText 的边框
  5. Android(安卓)Activity设置全屏
  6. Android中的资源与国际化
  7. Android(安卓)操作软键盘
  8. android WebView加载html5介绍
  9. Android中的style和theme的用法

随机推荐

  1. Android Activity sleep 自线程更新主线
  2. Android onSaveInstanceState和onRestore
  3. android studio 55[2]线程更新UI handler
  4. Android Applications Tutorial 13. Inte
  5. 自定义android 系统映像与皮肤,并运行
  6. Android 录音 与播放本地音乐功能的实现
  7. android安装apk程序
  8. Android PMEM的机制和原理
  9. Android 模拟器检测记录
  10. Speed Up and Back Up Your Rooted Andro