Android 隐藏输入弹框

        InputMethodManager mImm;
        private Activity mContext;
        
        @Override
        protected void onCreate(Bundle savedInstanceState) {
    
    
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_chat);
        mContext=this;
        this.mImm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
        }

        private void dismissSoftInput() {
    
    
            if (mImm != null) {
    
    
                mImm.hideSoftInputFromWindow(ekBar.getEtChat().getWindowToken(), 0);
                mShowSoftInput = false;
            }
            try {
    
    
                Thread.sleep(200);
            } catch (InterruptedException e) {
    
    
                e.printStackTrace();
            }
      }

猜你喜欢

转载自blog.csdn.net/weixin_37077736/article/details/126390742
今日推荐