The login interface has an edit box that enters the user name and password:
Private EditText et_username;//account private EditText et_password;//password
The layout file is as follows:
<EditText Android:id= "@+id/login_et_username"Android:layout_width= "Fill_parent"Android:layout_height= "Fill_parent"Android:layout_weight= "1"Android:background= "@null"Android:drawableleft= "@drawable/account_icon"android:drawablepadding= "7DP"Android:hint= "@string/login_num"Android:paddingleft= "15DP"android:singleline= "true"Android:textcolor= "@android: Color/white"Android:textcolorhint= "@color/login_frame_hint_color"android:textsize= "20SP"/><EditText Android:id= "@+id/login_et_userpassword"Android:layout_width= "Fill_parent"Android:layout_height= "Fill_parent"Android:layout_weight= "1"Android:background= "@null"Android:drawableleft= "@drawable/password_icon"android:drawablepadding= "7DP"Android:hint= "@string/login_password"Android:inputtype= "Textpassword"android:imeoptions="Actiongo"Android:paddingleft= "15DP"android:singleline= "true"Android:textcolor= "@android: Color/white"Android:textcolorhint= "@color/login_frame_hint_color"android:textsize= "20sp"/>
Acvity implementation of the monitoring Input method Enter the login operation:
Monitoring of Password text boxes
Et_password.setoneditoractionlistener (NewOneditoractionlistener () {@Override Public BooleanOneditoraction (TextView V,intActionId, KeyEvent event) {
To determine what action is performed on Goif(ActionId = =Editorinfo.ime_action_go) {Inputmethodmanager IMM=(Inputmethodmanager) v. GetContext (). Getsystemservice ( Context.input_method_service); if(Imm.isactive ()) {Imm.hidesoftinputfromwindow (v.getapplic Ationwindowtoken (),0); }//Execute the Login method and submit the form action. return true; } return false; } });
Android Input Method Listener events