gpt4 book ai didi

android - 关注弹出窗口中的 EditText 会使 Activity 进入休眠状态

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:46:45 25 4
gpt4 key购买 nike

我在我的 android 项目中的 PopupWindow 上放置了一个 EditText。当设置PopupWindow.setFocusable为false时,软键盘将不会显示。当将 PopupWindow.setFocusable 设置为 true 时,EditText 将获得焦点并且 Activity 进入休眠状态!弹出窗口上的其他项目有效,但手机上的后退按钮和在弹出窗口外单击不会关闭它。提前致谢。

最佳答案

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

        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 是透明图像。

关于android - 关注弹出窗口中的 EditText 会使 Activity 进入休眠状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13899062/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com