通过设置android:imeOptions来改变软键盘Enter键图标
来源:互联网 发布:北京少儿编程培训机构 编辑:程序博客网 时间:2024/04/28 06:59
1.actionUnspecified 未指定,对应常量EditorInfo.IME_ACTION_UNSPECIFIED.
2.actionNone 没有动作,对应常量EditorInfo.IME_ACTION_NONE
3.actionGo 去往,对应常量EditorInfo.IME_ACTION_GO
4.actionSearch 搜索,对应常量EditorInfo.IME_ACTION_SEARCH
5.actionSend 发送,对应常量EditorInfo.IME_ACTION_SEND
6.actionNext 下一个,对应常量EditorInfo.IME_ACTION_NEXT
7.actionDone 完成,对应常量EditorInfo.IME_ACTION_DONE
android键盘中的enter键图标是可以用EditText的android:imeOptions标签变更的。
显示search图标需要设置为android:imeOptions="actionSearch",android:inputType="text"将键盘设置为文字输入布局
则键盘中search按钮正常出现。
捕捉编辑框软键盘enter事件:
1)setOnKeyListener
2)OnEditorActionListener
实现android按下回车键便隐藏输入键盘,有两种方法:
1)如果布局是多个EditText,为每个EditText控件设置android:singleLine=”true”,弹出的软盘输入法中回车键为next,直到最后一个获取焦点后显示为Done,点击Done后,软盘输入键盘便隐藏。或者将EditText的imeOptions属性设置android:imeOptions=”actionDone”,则不管是不是最后一个EditText,点击回车键即隐藏输入法。
2)监听Enter的事件,编写Enter的事件响应。设置文本框的OnKeyListener,当keyCode ==KeyEvent.KEYCODE_ENTER的时候,表明Enter键被按下,就可以编写自己事件响应功能了
EditText password=(EditText)findViewById(R.id.password);password.setOnKeyListener(new OnKeyListener(){public boolean onKey(View v, int keyCode, KeyEvent event) {if(keyCode == KeyEvent.KEYCODE_ENTER){InputMethodManager imm = (InputMethodManager)v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);if(imm.isActive()){imm.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0 );}return true;}return false;}});
参见:
http://blog.csdn.net/liuxiit/article/details/6903884
http://fariytale.iteye.com/blog/1233625
- 通过设置android:imeOptions来改变软键盘Enter键图标
- 通过设置android:imeOptions来改变软键盘Enter键图标
- 通过设置android:imeOptions来改变软键盘Enter键图标
- 设置EditText的android:imeOptions来改变软键盘Enter键图标
- 改变软键盘Enter键功能
- android 软键盘Enter键图标的设置 android:imeOptions
- android 软键盘Enter键图标的设置 android:imeOptions
- Android 改变软键盘右下角样式
- android 修改键盘enter图标,设置搜索等图标
- android中的EditText的一个改变软键盘的属性
- Android软键盘之代码改变软键盘状态
- Android enter键设置键盘搜索回车
- Android App监听软键盘按键的三种方式与改变软键盘右下角确定键样式
- Android 监听软键盘按键与改变软键盘右下角按键样式
- android 软键盘Enter键图标的设置
- android editText 软键盘enter键图标的设置
- android editText 软键盘enter键图标的设置
- android editText 软键盘enter键图标的设置
- UNIX环境高级编程——标准I/O库
- C++ 中内存分配和回收
- 【rzxt】Windows安全模式的应用技巧
- hdu 1300 Pearls DP
- 调整数组使奇数位元素为奇数,偶数为元素为偶数
- 通过设置android:imeOptions来改变软键盘Enter键图标
- JDK环境变量设置
- HTML 5 新的标签用法以及和HTML 4的区别
- 【MAVEN 系列】MAVEN查询库
- ebp指针,参数,和局部变量的关系
- C++模板学习
- HttpClient 教程
- PopupWindow(四)
- 继承与接口之覆盖之一