android之软件键盘

不弹出软件键盘

<activity android:name="PresCompleteActivity"
             android:windowSoftInputMode="adjustUnspecified|stateHidden"
             android:theme="@style/MyDialogStyle" />

 

设置软件键盘类型

  private InputMethodManager mInputMethodManager;

  mInputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
   ed_name = (EditText)findViewById(R.id.ed_name);
     ed_age = (EditText)findViewById(R.id.ed_age);
     ed_name.setInputType(InputType.TYPE_CLASS_TEXT);
     ed_age.setInputType(InputType.TYPE_CLASS_NUMBER);

 

关闭软件键盘

  mInputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);

posted on 2014-04-14 15:06  strangeman  阅读(172)  评论(0编辑  收藏  举报

导航