Android设置软键盘右下角为搜索
生活随笔
收集整理的这篇文章主要介绍了
Android设置软键盘右下角为搜索
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
需要注意的是,修改软键盘为搜索或者其他时,需要设置
android:singleLine="true"否则无效
要设置软键盘为搜索的EditText布局文件中
android:imeOptions="actionSearch"或者在代码中为要软键盘为搜索的EditText设置
searchEditText.setImeOptions(EditorInfo.IME_ACTION_SEARCH);软键盘搜索事件
searchEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {@Overridepublic boolean onEditorAction(TextView v, int actionId, KeyEvent event) {if(actionId==EditorInfo.IME_ACTION_SEARCH){//执行搜索操作//TODO..return true;}return false;}});其余常用imeOptions
右下角变为完成
android:imeOptions="actionDone"右下角变为发送
android:imeOptions="actionSend"右下角变为前往
android:imeOptions="actionGo"右下角变为下一项
android:imeOptions="actionNext"
总结
以上是生活随笔为你收集整理的Android设置软键盘右下角为搜索的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: getservbyname、getser
- 下一篇: 网易考拉Android客户端路由总线设计