/** layout must set properties <singleline & Imeoptions>*/<edittext android:id= "@+id/edt_searchmicrofilm" Android Oid:layout_width= "Fill_parent" android:layout_height= "32DP" android:layout_marginright= "10DP "Android:background=" @drawable/search_frame_shape_circle "android:gravity=" center_vertical " android:hint= "@string/plaseinputkeywords" android:paddingleft= "25DP" Android : textcolorhighlight= "@color/jxinputframehinttextcolor" android:textcolor= "@color/jxtitletextword" android:imeoptions= "Actionsearch" android:singleline= "true" android:textsize= "14SP" &G T </edittext>
/** write its own function code in the activity class, that is, set the Listener event: */edittext.setoneditoractionlistene (Newtextview.oneditoractionlistener () { public boolean oneditoraction (TextView v, int ActionId, keyevent event) {if (ActionId = = Editorinfo.ime_action_search | | (Event!=null && event.getkeycode () = = Keyevent.keycode_enter)) {//write the features you want to implement here ... return true; } return false;<pre name= "code" class= "Java" > }
I think since you came here to read this article at least want to know how to reset the phone pop-up on the soft keyboardEnterfunction. Make a clickEnterkey, and then respond to the functionality you want to implement. and the interface replacement of the software disk has such a propertyandroid:imeoptionsto meet our needs, this property can take the value of theNormal,actionunspecified,Actionnone,Actiongo,Actionsearch,Actionsend,Actionnext,Actiondone, for example: a value ofActionnextwhenEnterThe key appearance becomes a downward arrow;ActionsearchTimeEnterKey appearance becomes"Search"two characters, and the value isActiondonewhenEnterThe key appearance becomes"Complete"two characters.
When making your own custom response to the feature set, be aware that < below three must meet >:
1. set its properties in the XML layout android:imeoptions, such as;
2. set its properties android:singleline= "true" in the XML layout, guaranteeing that when you click the ENTER key, can be heard correctly;
3. set the Listener in the code:edittext.setoneditoractionlistene (); and complete the function code that you want to implement;
How to set the monitor of enter in soft keyboard