简体   繁体   English

Kotlin - Inflated View 键盘中的 EditText 以黑色不透明度显示在背面

[英]Kotlin - EditText in Inflated View keyboard show on back with black opacity

I inflated popup view with below code but the problem is keyboard is shown backof popup我用下面的代码膨胀了弹出视图,但问题是键盘显示在弹出窗口的后面

 val inflater = it.context?.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater?
            val menuPopup = inflater!!.inflate(R.layout.popup_search_new_cosmetics,null)

            val popup = PopupWindow(menuPopup, WindowManager.LayoutParams.MATCH_PARENT,
                WindowManager.LayoutParams.MATCH_PARENT, false)
            popup.showAtLocation(menuPopup, Gravity.CENTER,0,0)
            val imgClose = menuPopup.findViewById<ImageView>(R.id.imageClose)
            menuPopup.findViewById<ImageView>(R.id.imageClose)
            recycler = menuPopup.findViewById(R.id.editProductPage)

            showKeyboard(menuPopup.findViewById(R.id.editTextSearch),this)


private fun showKeyboard(mEtSearch: EditText, context: Context) {
    mEtSearch.requestFocus()
    val imm = context.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
    imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0)
}

在此处输入图像描述

I suggest to use Alert dialog...我建议使用警报对话框...

Use this code.使用此代码。 Your problem will be solved你的问题将得到解决

popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM