[英]I inflated a view 5 times, the view which was inflated had a EditText, now i have 5 EditText on the screen, how to get the text from those EditTexts
[英]Kotlin - EditText in Inflated View keyboard show on back with black opacity
我用下面的代码膨胀了弹出视图,但问题是键盘显示在弹出窗口的后面
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)
}
我建议使用警报对话框...
使用此代码。 你的问题将得到解决
popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.