如何检测Android软件键盘何时隐藏?
我需要检测 Android 软件键盘何时隐藏。 我的活动当前响应何时隐藏硬件键盘,但软件键盘看起来只能通过大小更改事件来暗示。
有谁知道当用户取消键盘模式而隐藏软件键盘时视图或活动可以收到通知的方式吗?
I need to detect when the android software keyboard is hidden. My activity currently responds to when the hardware keyboard is hidden but the software keyboard looks like it can only be implied through a size changed event.
Does anyone know of a way that a view or activity can receive a notification when the software keyboard is hidden by the user cancelling out of keyboard mode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
强制软键盘始终可见有帮助吗?
您可以将其添加到 Activity 的 xml 文件中,以确保软键盘在该 Activity 中始终可见:
http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft
Would forcing the sof tkeyboard to always be visible help?
You can add this to your Activity's xml file to ensure the softkeyboard is always visible in that Activity:
http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft
没有真正的方法来检查,但您可以检查其上的操作是否有效。
如果键盘已关闭,则返回 false;如果键盘已打开且正在关闭,则返回 true。
Theres no real way to check, but you can check if an action on it works or not
This will return false if the keyboard was closed and true if it was open and is now being closed.
我通过搜索后退键解决了这个问题。 当收到后退键时我知道软键盘将被取消。
I solved this by just searching for the back key. When the back key is received I know that the soft keyboard will be cancelled.