Android Click EditText always does not eject software keyboard implementation code _android

Source: Internet
Author: User

Android Click EditText always does not eject the software keyboard

Scene Description: Under normal circumstances, when clicked EditText, the soft keyboard will bounce out. Now the requirement is when clicking EditText, the Bounce Date selection dialog box, the selected results are displayed on the EditText. If not handled, when clicked EditText, Soft Keyboard and dialog box will pop up, obviously users will feel uncomfortable.

Solution, when clicked EditText:

1, store the current input type
2, set input type for inputtype.type_null, no mobile phone soft keyboard
3, restore the original input type, because this operation is finished, but also to allow users to modify.
4, Pop-up Date selection dialog box, after the operation of the results displayed to the EditText.

Hide the software disk, the code is as follows:

EditText et_start_time = (edittext) This.findviewbyid (r.id.et_start_time); 
       int intype = Et_start_time.getinputtype (); 
       Et_start_time.setinputtype (inputtype.type_null);  
       Et_start_time.ontouchevent (event); 
       Et_start_time.setinputtype (intype); 
       Et_start_time.setselection (Et_start_time.gettext (). Length ()); 

Thank you for reading, I hope to help you, thank you for your support for this site!

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.