Android Input Method Listener events

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.