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客户端路由总线设计