Android调用系统软键盘
2024-10-14 03:21:01
/**
*
* @MethodName:closeInputMethod
* @Description:关闭系统软键盘
* @throws
*/
public void closeInputMethod(){
try {
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE))
.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
} catch (Exception e) { }finally{ }
}
/**
*
* @MethodName:openInputMethod
* @Description:打开系统软键盘
* @throws
*/
public void openInputMethod(final EditText editText){
Timer timer = new Timer();
timer.schedule(new TimerTask() {
public void run() {
InputMethodManager inputManager = (InputMethodManager) editText
.getContext().getSystemService(
Context.INPUT_METHOD_SERVICE);
inputManager.showSoftInput(editText, 0);
}
}, 200);
}
最新文章
- python+selenium 浏览器的问题
- Divide Two Integers leetcode
- 使用Fragment应用放置后台很久,被系统回收,出现crash
- C#组态控件Iocomp应用案例
- unity vr sample on htc vive
- php 根据指定的键对多维数组进行排序
- css 内联元素inline 行框全解
- Spark源码编译
- Bootstrap学习笔记(三) 网格系统
- Chrome插件:网页截图
- Core love JavaScript
- ubuntu12.04下安装pptp_vpn服务器
- Less注释语法
- win10使用u盘装回win7
- gstreamer在Ubuntu下构建开发环境
- 059 SparkStream介绍
- Anaconda安装python(idea兼容)
- jQuery筛选--find(expr|obj|ele)和siblings([expr])
- maven 入门 (二)
- 元组类型&;字典类型
热门文章
- SQL字符串分割解析
- 005-Go 操作PostgreSQL数据库
- gradle 配置及设置本地仓库
- MySQL auto_increment初始值设置
- AndroidStudio 中查看获取MD5和SHA1值以及如何查看手机应用信息以及读取*.db数据库里面数据
- 算法笔记_227:填写乘法算式(Java)
- 写一个function,清除字符串前后的空格。(兼容所有浏览器)
- C/C++与Java的区别
- Ulua_toLua_基本案例(八)_LuaAccessingArray
- 【DB2】SQL优化