android 显示和隐藏输入框

显示输入法

val manager = context?.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager?
manager?.showSoftInput(v, InputMethodManager.SHOW_IMPLICIT)

隐藏输入法

val manager = context?.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager?
if (manager?.isActive == true) {
    manager.hideSoftInputFromWindow(
        v.windowToken,
         InputMethodManager.HIDE_NOT_ALWAYS
    )
}

 

android 显示和隐藏输入框

上一篇:VMware启动时提示我已移动或我已复制该虚拟机


下一篇:uniapp实现支付功能