Focus on EditText in sleep pops up

I host an EditText on PopupWindow in my Android project. If PopupWindow.setFocusable set to false, the soft keyboard will not be displayed. And when the value of PopupWindow.setFocusable set to true, the EditText focuses and the activity goes into sleep mode! Another item in the popup window works, but the back button on the phone and clicking outside the popup does not close it. Thanks in advance.

+4
source share
2 answers

I just set setBackgroundDrawable of PopupWindow . Everything seems to be in order! I'm terrified!

+2
source

Some code from my project may help

  LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); PopupWindow share_popup = new PopupWindow(inflater.inflate(R.layout.share_dropdown, null, false), 162, LinearLayout.LayoutParams.WRAP_CONTENT, true); share_popup.setOutsideTouchable(true); share_popup.setTouchable(true); share_popup.setFocusable(true); Drawable image_saved = getResources().getDrawable(R.drawable.dummy_bg); share_popup.setBackgroundDrawable(image_saved); 

where is R.drawable.dummy_bg is a transparent image.

+8
source

All Articles