The Method of Completely Hiding Soft Keyboard Developed by Android

  • 2021-07-24 11:48:12
  • OfStack

Hiding soft keyboard 1 is my headache, and I haven't found a real way to hide it. The soft keyboard always pops up when you click EditText. ----Cups and utensils

Cups (1):


InputMethodManager im =(InputMethodManager) mEdit  
 getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); 
 im.hideSoftInputFromWindow(SoftKeyTest.this.getCurrentFocus().getWindowToken(),  
      InputMethodManager.HIDE_NOT_ALWAYS); 

Cups (2):


<activity android:name=".SoftKeyTest" 
          android:windowSoftInputMode="stateAlwaysHidden"// Join the line  
          android:label="@string/app_name"> 
       <intent-filter> 
         <action android:name="android.intent.action.MAIN" /> 
         <category android:name="android.intent.category.LAUNCHER" /> 
       </intent-filter> 
     </activity> 

Cups (3):


mEdit.setOnClickListener(new View.OnClickListener() {        
  @Override 
  public void onClick(View v) { 
  // TODO Auto-generated method stub 
    Please don't come out;        
  } 
 }); 

One try at a time, this parameter finally hides the soft keyboard:

Washing utensils (1):


EditText et=(EditText)findViewById(R.id.edit);  
 et.setInputType(InputType.TYPE_NULL); 

Related articles: