1. Control by code:
show input method panel:
view plaincopy to clipboardprint?
- final View v = getWindow().peekDecorView();
- if (v != null && v.getWindowToken() != null) {
- InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
- imm.toggleSoftInputFromWindow(v.getWindowToken(), 0, 0);
- }
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:
view plaincopy to clipboardprint?
- final View v = getWindow().peekDecorView();
- if (v != null && v.getWindowToken() != null) {
- InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
- imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
- }
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:
view plaincopy to clipboardprint?
- android:windowSoftInputMode=["stateUnspecified",
- "stateUnchanged", "stateHidden",
- "stateAlwaysHidden", "stateVisible",
- "stateAlwaysVisible", "adjustUnspecified",
- "adjustResize", "adjustPan"]