android中调用软键盘
2014-11-16 17:56
183 查看
一、打开输入法窗口:
InputMethodManager
inputMethodManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
// 打开软键盘并接受输入的编辑文本或其它视图
imm.showSoftInput(submitBt,InputMethodManager.SHOW_FORCED);
二、关闭输入入法窗口
InputMethodManager inputMethodManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(OpeListActivity.this.getCurrentFocus().getWindowToken(),InputMethodManager.H
ID E_NOT_ALWAYS);
//接受软键盘输入的编辑文本或其它视图
inputMethodManager.showSoftInput(submitBt,InputMethodManager.SHOW_FORCED);
三、如果输入法打开则关闭,如果没打开则打开
InputMethodManager m=(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
m.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
四、获取输入法打开的状态
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
boolean isOpen=imm.isActive();
isOpen若返回true,则表示输入法打开
InputMethodManager
inputMethodManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
// 打开软键盘并接受输入的编辑文本或其它视图
imm.showSoftInput(submitBt,InputMethodManager.SHOW_FORCED);
二、关闭输入入法窗口
InputMethodManager inputMethodManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(OpeListActivity.this.getCurrentFocus().getWindowToken(),InputMethodManager.H
ID E_NOT_ALWAYS);
//接受软键盘输入的编辑文本或其它视图
inputMethodManager.showSoftInput(submitBt,InputMethodManager.SHOW_FORCED);
三、如果输入法打开则关闭,如果没打开则打开
InputMethodManager m=(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
m.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
四、获取输入法打开的状态
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
boolean isOpen=imm.isActive();
isOpen若返回true,则表示输入法打开
相关文章推荐
- Android调用系统软键盘
- Android自动调用软键盘
- 【Android】EditText标签调用键盘
- android中关于调用键盘的问题
- Android踩坑日记:监听软键盘多次调用和刷新系统相册和获取所有相片
- 系统软键盘">Android在外接物理键盘时,如何强制调用系统软键盘?
- 【Android】调用Android中的软键盘
- Android之什么时候调用onSaveInstance方法的时候(为什么按Home键盘会调用,按Back不调用)
- [置顶] Android在外接物理键盘时,如何强制调用系统软键盘
- 调用Android中的软键盘
- Android调用系统键盘的方法
- Android 隐藏底部导航栏和状态栏,动态调用导航栏,键盘收回时也收回导航栏
- 有关Android调用服务全解析
- 深入Android 【四】 —— 组件调用
- Android 里js 与java相互调用
- android调用平台功能
- android phone电话调用流程
- 调用android平台功能-拨号,地图,网页,短信,Email,播放多媒体
- Android 学习心得之Activity间调用异常
- 【Android翻译】关于Activity的onSaveInstanceState调用时机的说明