Go Android EditText does not eject IME and cursor settings

Source: Internet
Author: User

Recently in the dial-up application, you need to click on the input box to play a custom keyboard, hide the system's input method. Online to find a lot of information, finally to solve, through Android:inputtype: Specify the type of input method, int type, you can use | select multiple. The value can be referenced by: Android.text.InputType class. The values include: Text,texturi, Phone,number, etc.

In the Android SDK there is such a phrase "If the given content type is Type_null then a soft keyboard would not be displayed for this text view",
First change the EditText inputtype to Type_null, the input method will not pop up. Then set the listener, and then reset its inputtype.

Et_input.setontouchlistener (NewOntouchlistener () {@Override Public BooleanOnTouch (View V, motionevent event) {LOGUTIL.E (TAG,"EditText Click"); intIntype = Et_input.getinputtype ();//backup the input typeEt_input.setinputtype (Inputtype.type_null);//Disable Soft inputEt_input.ontouchevent (event);//Call Native HandlerEt_input.setinputtype (Intype);//Restore input type//after the cursor is placedCharsequence Text =Et_input.gettext (); if(Textinstanceofspannable) {spannable Spantext=(spannable) text;                Selection.setselection (Spantext, Text.length ()); }                                if(Ll_keyboard.getvisibility () ==view.gone) {//pop-up dial padll_options.setvisibility (View.gone);                Ll_keyboard.setvisibility (view.visible); }                return true; }                            });



Source: http://www.xuebuyuan.com/2005929.html

Go Android EditText does not eject IME and cursor settings

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.