如何在 PopupWindow 上显示键盘?
我正在使用 PopupWindow
类,在 PopupWindow
上我有一个 EditText
,我的问题是,当 PopupWindow
可见且我点击EditText
,当时软键盘不可见,我无法输入输入。谁能告诉我如何解决这个问题?
I am using PopupWindow
class and on PopupWindow
I have one EditText
, my problem is that when PopupWindow
is visible and I click on EditText
at that time the soft keyboard is not visible and I am not able to enter Input. Can anybody tell me how to solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
当你创建一个新的
PopupWindow
时,使用另一个构造函数方法,你必须设置focusable = true;
只有视图可以获得焦点,软键盘才会显示。默认可聚焦为“false”
When you create a new
PopupWindow
, use another constructor method, you must set thefocusable = true;
only the view could be focusable, the soft keyboard will show .The Default focusable is 'false'
花了相当多的时间才弄清楚,但是在这里:
在创建弹出窗口时,我必须设置文本框(Edittext)以在接收焦点时强制打开软键盘。
Took quite a bit to figure out, but here you go:
While creating the popup, I had to set the textbox (Edittext) to force opening the soft keyboard when receiving focus.
添加此代码
popupWindow.setFocusable(true);
Add this code
popupWindow.setFocusable(true);
这对我有用。
This worked for me.