Android开发之完全隐藏软键盘的方法

2019/7/7 19:43:49

本文主要是介绍Android开发之完全隐藏软键盘的方法,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

隐藏软键盘一直是我头痛的事情,没有找到一种真正能隐藏的方法。点击EditText的时候总是弹出软键盘。-----杯具

杯具(一):

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

杯具(二):

<activity android:name=".SoftKeyTest" 
          android:windowSoftInputMode="stateAlwaysHidden"//加入这行 
          android:label="@string/app_name"> 
       <intent-filter> 
         <action android:name="android.intent.action.MAIN" /> 
         <category android:name="android.intent.category.LAUNCHER" /> 
       </intent-filter> 
     </activity> 

杯具(三):

mEdit.setOnClickListener(new View.OnClickListener() {        
  @Override 
  public void onClick(View v) { 
  // TODO Auto-generated method stub 
   求求你别出来了;       
  } 
 }); 

一个一个尝试,这个参数终于把软键盘隐藏了:

洗具(一):

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

以上所述是小编给大家介绍的Android开发之完全隐藏软键盘的方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对找一找教程网网站的支持!



这篇关于Android开发之完全隐藏软键盘的方法的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程