[英]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.