0
点赞
收藏
分享

微信扫一扫

android隐藏与现实键盘


1. Control by code:

 

     show input method panel:

​​view plain​​​ ​​​copy to clipboard​​​ ​​​print​​​ ​​​?​​


  1. final
  2. if (v != null && v.getWindowToken() != null) {
  3. InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
  4. 0, 0);
  5. }

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 plain​​​ ​​​copy to clipboard​​​ ​​​print​​​ ​​​?​​


  1. final
  2. if (v != null && v.getWindowToken() != null) {
  3. InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
  4. 0);
  5. }

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 plain​​​ ​​​copy to clipboard​​​ ​​​print​​​ ​​​?​​


  1. android:windowSoftInputMode=["stateUnspecified",
  2. "stateUnchanged", "stateHidden",
  3. "stateAlwaysHidden", "stateVisible",
  4. "stateAlwaysVisible", "adjustUnspecified",
  5. "adjustResize", "adjustPan"]
举报

相关推荐

0 条评论