在Android中使用PhoneGap停用菜单按钮 [英] Disabling menu button in Android using PhoneGap

查看:110
本文介绍了在Android中使用PhoneGap停用菜单按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PhoneGap和jQuery Mobile创建我的第一个移动应用程序,我遇到了一个小问题。

I'm building my first mobile app using PhoneGap and jQuery Mobile, and I've run into a little issue.

我已经在Android上测试,在物理设备和仿真器上。因为这个应用程序很简单,没有什么太多的设置,我想禁用菜单按钮。

I've been testing it on Android, both on a physical device and the emulator. As this application is very simple and has nothing much in the way of settings, I'd like to disable the Menu button.

现在,我从 PhoneGap文档是您需要添加一个事件侦听器menubutton事件以覆盖默认行为,并使用preventDefault来停止发生的默认操作。尝试,我可能,我似乎不能得到它的工作。我为其编写的代码位于 JSFiddle 上。

Now, the impression I got from the PhoneGap documentation is that you need to add an event listener for the menubutton event in order to override the default behaviour, and use preventDefault to stop the default action taking place. Try as I might, I can't seem to get it to work. The code I've written for it is on JSFiddle.

这是可能吗?如果是这样,任何想法,我错了?

Is this possible? If so, any idea where I'm going wrong?

编辑:应该真的提到的版本 - 我使用PhoneGap 2.0。

Should really have mentioned the version - I'm using PhoneGap 2.0.

推荐答案

我有同样的问题。

在src文件夹下的.java文件夹(MainActivity.java似乎是默认的文件名),注释掉onCreateOptionsMenu函数。

In the .java file under the src folder (MainActivity.java appears to be the default file name), comment out onCreateOptionsMenu function.

这篇关于在Android中使用PhoneGap停用菜单按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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