Android-----Completely hide the soft keyboard

Source: Internet
Author: User

Hiding the soft keyboard has always been a headache for me, and I haven't found a way to really hide it. The soft keyboard always pops up when you click EditText. -----Cups

Cup (a):

Java code
    1. Inputmethodmanager im = (inputmethodmanager) medit
    2. . GetContext (). Getsystemservice (Context.input_method_service);
    3. Im.hidesoftinputfromwindow (softkeytest. This.getcurrentfocus (). Getwindowtoken (),
    4. Inputmethodmanager.hide_not_always);

Cup (ii):

XML code
  1. <activity android:name=". Softkeytest "
  2. android:windowsoftinputmode="Statealwayshidden"//Join this line
  3. android:label="@string/app_name">
  4. <intent-filter>
  5. <action android:name="Android.intent.action.MAIN" />
  6. <category android:name="Android.intent.category.LAUNCHER" />
  7. </intent-filter>
  8. </Activity>

Cups (iii):

Java code
    1. Medit.setonclicklistener (new View.onclicklistener () {
    2. @Override
    3. public void OnClick (View v) {
    4. //TODO auto-generated method stub
    5. Don't come out, please.
    6. }
    7. });

One attempt, this parameter finally hides the soft keyboard:

Washing tool (a):

Java code
    1. EditText et= (EditText) Findviewbyid (R.id.edit);
    2. Et.setinputtype (Inputtype.type_null);

Android-----Completely hide the soft keyboard

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.