Recently, because of the project needs, the focus of the edittext needs to be shifted to Lineralayout: After you have entered the EditText, click the Enter key or press OK on other embedded Android devices to get the Lineralayout click event.
This method can be called Initlistener in the OnCreate method;
1 /**2 * Listen to the focus of the EditText, click the Enter key (or press OK), lose focus, turn focus to ImageView3 */4 Private voidInitlistener () {5Mettrainid.setoneditoractionlistener (NewTextview.oneditoractionlistener () {6 Public BooleanOneditoraction (TextView V,intActionId, KeyEvent event) {7 if(ActionId = =Editorinfo.ime_action_send8|| (Event! =NULL&& Event.getkeycode () = =keyevent.keycode_enter)) {9Mettrainid.setfocusable (false);TenMllfunction.setfocusable (true); One Mllfunction.requestfocus (); A Mllfunction.findfocus (); - return true; - } the return false; - } - }); -}
Android Development in EditText Click enter key focus change processing (get focus and lose focus interactive change)