Android开发中模拟Home键操作和关闭手机软键盘
来源:互联网 发布:桌面便签提醒软件 编辑:程序博客网 时间:2024/06/04 19:47
1,在点击返回时,不想退出应用,直接模拟HOME键操作,可以写在onKeyDown事件中,也可以写在其它自己想要实现的地方:
Intent intent = new Intent(Intent.ACTION_MAIN);
// 创建一个新的任务栈(这个必须要写)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addCategory(Intent.CATEGORY_HOME);
this.startActivity(intent);
2,监听关闭手机软键盘:
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (inputMethodManager != null && this.getCurrentFocus() != null) {
inputMethodManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
3,
0 0
- Android开发中模拟Home键操作和关闭手机软键盘
- Android 监听home键,及软键盘的弹起和关闭
- Android监听手机软键盘的弹起和关闭
- android 模拟home键操作
- android中软键盘的打开关闭及判断操作
- android中关闭软键盘
- android中关闭软键盘
- Android开发:在EditText中关闭软键盘
- Android开发:在EditText中关闭软键盘
- Android开发:在EditText中关闭软键盘
- Android开发:在EditText中关闭软键盘
- Android开发:在EditText中关闭软键盘
- (转)Android开发:在EditText中关闭软键盘
- [Android] Android应用开发中模拟按HOME键效果
- [Android] Android应用开发中模拟按HOME键效果
- Android中检测软键盘的弹出和关闭
- Android应用开发中模拟按HOME键效果
- Android应用开发中模拟按HOME键效果
- ios 根据类名获取类名的属性
- 冒泡排序
- 关于 AfxSocketInit() 的使用
- Visual Studio 2013: Error: 无法打开源文件 "iostream"
- Xcode出现could not build module foundation错误 解决方案
- Android开发中模拟Home键操作和关闭手机软键盘
- EOR逻辑异或指令
- 采访:关于 Go 语言和《Go Web编程》
- P2P流媒体技术方案
- 黑马程序员——IO流(一)
- 史上最全设计模式导学目录(完整版)
- 基本的排序算法:冒泡排序、插入排序、希尔排序、选择排序、归并排序、快速排序、堆排序
- 常用ARM汇编指令
- eclipse 下github 安装