Modify the project today and change the homepage search. After the user enters the keyword, press the software keyboard and press enter to jump to the result page.
CodeNo problem. I don't know why I always jump to the secondary node. debug debugging found that the second step of setonkeylistener execution had not been found to solve the problem.
Finally, I checked the API of the Chinese version and found a setoneditexceptionlistener event.
I changed the search event setonkeylistener to setoneditexceptionlistener.
Then change XML
<Edittextandroid: Id = "@ + ID/searbox" style = "@ style/indexsearchbox" Android: layout_toleftof = "@ ID/searchbtn" Android: hint = "@ string/pleasekey" Android: layout_height = "45dip" Android: singleline = "true" Android: imeoptions = "actiongo"/> indicates changing the Enter key on the software keyboard to go
Code:
// Click the software keyboard carriage return event
// Click the press ENTER event txtkeyword. setoneditexceptionlistener (New edittext. oneditexceptionlistener () {@ overridepublic Boolean oneditexception (textview V, int actionid, keyevent event) {// todo auto-generated method stubif (actionid = editorinfo. ime_action_go) {// jump activityreturn true;} else {toast. maketext (context, R. string. key_word, toast. length_short ). show (); Return true ;}} return false ;}});
The test and debugging are successful.
The second question of this jump is a few hours ....