android 小问题 - android设置弹出软键盘却没有弹出来
来源:互联网 发布:手机耳机音效增强软件 编辑:程序博客网 时间:2024/06/05 12:18
android设置弹出软键盘却没有弹出来
很多应用中对于一个界面比如进入搜索界面或者修改信息等等情况,为了用户体验应该自动弹出软键盘而不是让用户主动点击输入框才弹出(因为用户进入该界面必然是为了更改信息)。具体实现这种效果如下:
EditText editText.setFocusable(true); editText.setFocusableInTouchMode(true); editText.requestFocus();InputMethodManager inputManager = (InputMethodManager)editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(editText, 0);
首先要对指定的输入框请求焦点。然后调用输入管理器弹出软键盘。
警告:对于刚跳到一个新的界面就要弹出软键盘的情况上述代码可能由于界面为加载完全而无法弹出软键盘。此时应该适当的延迟弹出软键盘如998毫秒(保证界面的数据加载完成)。实例代码如下:
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); } }, 998);
0 0
- android 小问题 - android设置弹出软键盘却没有弹出来
- android 软键盘弹出,布局没有整体向上顶问题
- android弹出软键盘
- Android软键盘弹出
- Android软键盘弹出
- android设置自动弹出软键盘
- android设置EditText不弹出软键盘
- android 软键盘的弹出问题总结
- Android 处理软键盘弹出问题
- 关于Android软键盘弹出的问题
- Android软键盘弹出问题的解决方法
- Android 弹出软键盘的问题
- Android Dialog弹出时的软键盘弹出问题
- android 自动弹出软键盘
- android自动弹出软键盘
- android 默认弹出软键盘
- Android自动弹出软键盘
- Android强制弹出软键盘
- 获取自定义View中Text文本的实际宽高
- python time模块详解
- 8/4
- OFBizChina: 理解MVC模式
- android的scaletype
- android 小问题 - android设置弹出软键盘却没有弹出来
- ibatis动态sql配置(in实例,模糊查询等)
- solr高亮、拼写检查及匹配相似简单实践
- poj3735 Training little cats(矩阵快速幂)
- leetcode 刷题之路 44 String to Integer (atoi)
- MFC复制目录树
- hogan shoes the "river source" of BYD
- 【discuz x3】discuz x3中切换数据库时需要修改如下三个文件
- abercrombie italia more than reflect the requirements of the national economy as a pilot area of