更改android中按键的功能
我开发了一个Android应用程序,其中布局中存在一些“确定”按钮(软键),它用于处理某些事件。我想在应用程序期间将其功能映射到我的手机中的硬键(如主页键)跑步。我还想知道如何区分单击按钮和双击按钮。如何知道两次按钮单击之间的时间间隔,以及我们是否可以更改该时间段来处理双击。
I have developed an android application in which some "OK" button (soft key) is present in the layout and it is used to handle some event .I want to map its functionality to hard key(like home key ) in my mobile during application run. I also want to know how to differentiate between single click and double click on an button. How to know the time gap between two button clicks and can we change that time period to handle double click.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不应该拦截主页按钮的功能。因为这是用户在任何阶段退出应用程序的唯一方式。您可以重写此函数来拦截
后退按钮
的功能:编辑:
You should not intercept the functionality of home button. as it is the only way that the user can come out of the app at any stage. You can override this function to intercept the functionality of
back button
:EDIT:
在 Android 中,您无法覆盖主页按钮,因此无论您想要做什么,请在按下后退键时执行。
In android you cant override home button hence whatever you want to do, do it when back key is pressed.