键盘隐藏事件BACK键 [英] Keyboard Hide Event with BACK key

查看:197
本文介绍了键盘隐藏事件BACK键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经注意到了 Android Market的应用程序,当你点击了搜索按钮,它显示了键盘,但是当你点击返回按钮,搜索的EditText 成为无形和键盘是隐藏的,是我不能隐藏的问题在的EditText 后后pressing返回键的键盘被隐藏,因为我无法找到一个侦听器隐藏键盘事件。 我发现这个样本<一个href="http://stackoverflow.com/questions/4312319/howto-capture-the-virtual-keyboard-show-hide-event-in-android">Howto捕捉虚拟键盘显示/隐藏事件的Andr​​oid? 但它不工作的软键盘上

I've noticed the Android Market Application, when you click over search button it shows the keyboard, but when you click the back button, the search EditText become invisible and the keyboard is hidden, the problem that I cant hide the EditText after the keyboard is hidden after pressing the back key, because i cant find a listener for hiding the keyboard event. I found this sample Howto capture the 'virtual keyboard show/hide' event in Android? but it doesnt work on soft keyboard

推荐答案

您需要实现这个捕捉BACK按钮之前被分派到IME:

You need to implement this to capture the BACK button before it is dispatched to the IME:

<一个href="http://developer.android.com/reference/android/view/View.html#onKey$p$pIme%28int,%20android.view.KeyEvent%29">http://developer.android.com/reference/android/view/View.html#onKey$p$pIme(int, android.view.KeyEvent)

这篇关于键盘隐藏事件BACK键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆