隐藏软键盘

    xiaoxiao2021-03-25  94

    最近做项目遇到了滑动RecyclerVIew隐藏软件盘的功能,在此记录下来。

     private void hintKbTwo() {         InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);         if(imm.isActive()&&getCurrentFocus()!=null){             if (getCurrentFocus().getWindowToken()!=null) {                 imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);             }         }     }

    在RecyclerView滑动监听的地方直接调用这个方法就OK了。

    转载请注明原文地址: https://ju.6miu.com/read-18142.html

    最新回复(0)