1. Control by code:
show input method panel:
- final View v = getWindow().peekDecorView();
- if (v != null && v.getWindowToken() != null) {
- InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
- imm.toggleSoftInputFromWindow(v.getWindowToken(), 0, 0);
- }
hide input method panel:
- final View v = getWindow().peekDecorView();
- if (v != null && v.getWindowToken() != null) {
- InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
- imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
- }
2. Control by manifest parament:
- android:windowSoftInputMode=["stateUnspecified",
- "stateUnchanged", "stateHidden",
- "stateAlwaysHidden", "stateVisible",
- "stateAlwaysVisible", "adjustUnspecified",
- "adjustResize", "adjustPan"]