Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/209.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在弹出窗口中聚焦编辑文本,活动进入睡眠状态_Android_Android Edittext_Popupwindow - Fatal编程技术网

Android 在弹出窗口中聚焦编辑文本,活动进入睡眠状态

Android 在弹出窗口中聚焦编辑文本,活动进入睡眠状态,android,android-edittext,popupwindow,Android,Android Edittext,Popupwindow,我在android项目中的PopupWindow上放置了一个EditText。当将PopupWindow.setFocusable设置为false时,软键盘将不显示。当将PopupWindow.setFocusable设置为true时,EditText被聚焦,活动进入睡眠状态! 弹出窗口上的其他项目也可以工作,但手机上的“后退”按钮并在弹出窗口外单击并不能关闭它。 提前感谢。我的项目中的一些代码可能会有所帮助 LayoutInflater inflater = (LayoutIn

我在android项目中的
PopupWindow
上放置了一个
EditText
。当将
PopupWindow.setFocusable
设置为false时,软键盘将不显示。当将
PopupWindow.setFocusable
设置为true时,
EditText
被聚焦,活动进入睡眠状态! 弹出窗口上的其他项目也可以工作,但手机上的“后退”按钮并在弹出窗口外单击并不能关闭它。
提前感谢。

我的项目中的一些代码可能会有所帮助

        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);

这里的
R.drawable.dummy\u bg
是一个透明的图像。

我刚刚设置了
弹出窗口的
setBackgroundDrawable
。一切似乎都很好!我惊呆了

谢谢你的回答。设置
setBackgroundDrawable
解决我的问题!我惊呆了!!谢谢<代码>新弹出窗口(充气器.充气(R.layout.share_下拉列表,null,false),162,LinearLayout.LayoutParams.WRAP_内容,true)
Last
boolean
value
true
解决了我的问题。发生了什么事,我的答案没有帮助吗?你的答案告诉我正确的答案。谢谢阿里(@AliImran)。