예제 #1
0
 public void dismissSoftInput() {
   // 隐藏软键盘
   InputMethodManager imm =
       ((InputMethodManager) mContext.getSystemService(Activity.INPUT_METHOD_SERVICE));
   if (mContext.getWindow().getAttributes().softInputMode
       != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
     if (mContext.getCurrentFocus() != null)
       imm.hideSoftInputFromWindow(
           mContext.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
   }
 }
예제 #2
0
 private void showSoftInput() {
   if (mContext.getWindow().getAttributes().softInputMode
       == WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
     if (mContext.getCurrentFocus() != null) {
       InputMethodManager imm =
           ((InputMethodManager) mContext.getSystemService(Activity.INPUT_METHOD_SERVICE));
       imm.showSoftInputFromInputMethod(mChatView.getWindowToken(), 0);
     }
   }
 }