专注于弹出窗口中的编辑文本会使活动进入睡眠状态



我在安卓项目中的PopupWindow上放置了一个EditText。当PopupWindow.setFocusable设置为 false 时,将不会显示软键盘。当PopupWindow.setFocusable设置为真实时,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_bg是透明图像。

我刚刚设置了PopupWindowsetBackgroundDrawable。一切似乎都很好!我惊愕了!!

最新更新