摘要: 开发过程中相信大家都有碰到因为不能捕获Home键而烦恼,现在终于有办法了,在Level5以上(包含)中,Activity类中有如下方法: public void onAttachedToWindow () Since: API Level 5 Called when the main wi ...
| 开发过程中相信大家都有碰到因为不能捕获Home键而烦恼,现在终于有办法了,在Level5以上(包含)中,Activity类中有如下方法: public void onAttachedToWindow () Since: API Level 5 Called when the main window associated with the activity has been attached to the window manager. See View.onAttachedToWindow() for more information. See Also * onAttachedToWindow()
当不需要捕获时,删除setType这一行就OK。 |
本文介绍了一种在Android Level5及以上版本中捕获Home键的方法。通过重写Activity中的onAttachedToWindow方法并设置窗口类型,可以实现对Home键的监听。当不再需要此功能时,只需简单地移除相应的设置即可。
617

被折叠的 条评论
为什么被折叠?



