Android-----完全隐藏软键盘 .转

from http://www.pin5i.com/showtopic-android-completely-hide-the-soft-keyboard.html

 

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

 

杯具(一):

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

杯具(二):

  1. <activity android:name=".SoftKeyTest"
  2.                           android:windowSoftInputMode="stateAlwaysHidden"//加入这行
  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>

杯具(三):

  1. mEdit.setOnClickListener(new View.OnClickListener() {
  2.                        
  3.   @Override
  4.   public void onClick(View v) {
  5.   // TODO Auto-generated method stub
  6.         求求你别出来了;                       
  7.   }
  8. });

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

 

洗具(一):

  1. EditText et=(EditText)findViewById(R.id.edit);
  2. et.setInputType(InputType.TYPE_DATETIME_VARIATION_NORMAL);
 
posted on 2010-11-11 14:55  boby house  阅读(860)  评论(0)    收藏  举报