通过设置android:imeOptions来改变软键盘Enter键图标
2014-06-06 20:15
591 查看
通过设置android:imeOptions来改变软键盘Enter键图标,有需要的朋友可以参考下。
转载自:
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键被按下,就可以编写自己事件响应功能了
[java]view plain
EditTextpassword=(EditText)findViewById(R.id.password);
password.setOnKeyListener(newOnKeyListener(){
if(keyCode==KeyEvent.KEYCODE_ENTER){
InputMethodManagerimm=(InputMethodManager)v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if(imm.isActive()){
imm.hideSoftInputFromWindow(v.getApplicationWindowToken(),0);
}
}
});
转载自:
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键被按下,就可以编写自己事件响应功能了
[java]view plain
EditTextpassword=(EditText)findViewById(R.id.password);
password.setOnKeyListener(newOnKeyListener(){
if(keyCode==KeyEvent.KEYCODE_ENTER){
InputMethodManagerimm=(InputMethodManager)v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if(imm.isActive()){
imm.hideSoftInputFromWindow(v.getApplicationWindowToken(),0);
}
}
});
相关文章推荐
- 通过设置android:imeOptions来改变软键盘Enter键图标
- 通过设置android:imeOptions来改变软键盘Enter键图标
- 设置EditText的android:imeOptions来改变软键盘Enter键图标
- android editText 软键盘enter键图标的设置
- android 软键盘Enter键图标的设置
- android 软键盘Enter键图标的设置
- android 软键盘Enter键图标的设置
- android editText 软键盘enter键图标的设置
- android editText 软键盘enter键图标的设置
- android editText 软键盘enter键图标的设置
- android 软键盘Enter键图标的设置 android:imeOptions
- 记一次,软键盘设置android:imeOptions="actionDone"在华为手机上无效的坑
- android 软键盘Enter键图标的设置 android:imeOptions
- 通过settings.db自定义Android系统默认设置:SHOW_IME_WITH_HARD_KEYBOARD 默认物理键盘与软键盘同时使用
- android 软键盘Enter键图标的设置 android:imeOptions
- android editText 软键盘enter键图标的设置
- android editText 软键盘enter键图标的设置
- Android软键盘遮住界面解决办法:通过软键盘改变视图位置
- 【Android常用控件】EditText常用属性【二】:为文本输入框指定软键盘类型和软键盘回车键图标设置
- 关于设置android:imeOptions属性无效的解决办法