隐藏软键盘一直是我头痛的事情,没有找到一种真正能隐藏的方法。点击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_DATETIME_VARIATION_NORMAL);