Android程序打开和关闭输入法
2014-08-24 18:12
399 查看
一、打开输入法窗口:
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.HIDE_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.HIDE_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程序打开和关闭输入法
- Android程序打开和关闭输入法
- Android程序打开和对输入法的操作(打开/关闭)
- 用Android程序打开和关闭输入法
- Android程序打开和关闭输入法
- Android程序打开和关闭输入法
- Android程序打开和关闭输入法,this.getCurrentFocus()有时为空,加try catch
- 用Android程序打开和关闭输入法
- Android打开和关闭输入法
- android 打开和关闭输入法
- Android输入法界面管理(打开/关闭/状态获取)
- android 输入法的打开和关闭
- Android程序:使用系统服务*1.获取网络状态 * 2.打开关闭wifi * 3.获取系统音量 * 4.获取运行程序的包名
- Android中如何通过程序打开或关闭GPS
- Android:打开和关闭输入法
- Android 在程序中关闭和打开屏幕
- Android 在程序中关闭和打开屏幕
- Android输入法界面管理(打开/关闭/状态获取)