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);

原文地址:https://www.cnblogs.com/profession/p/3664099.html