我从未在Java中编写任何单行,我对Java世界了解不多,所以当我听说我可以使用phonegap创建android应用时,我感到非常高兴。但正如我后来发现的那样,如果我想做更多的事情,我无法摆脱Java。
我想为我的应用程序创建设置页面,我发现phongeap extension允许我阅读phonegap应用程序设置但是要使用它我必须创建设置GUI,可以通过XML和一些Java来完成。我发现它很好tutorial但是因为我不是Java开发人员,所以我不能理解它。
有人可以告诉我在哪里放置所有这些Java和XML的东西,只需让设置GUI在phonegap应用程序中工作。我指的是我需要的文件,内容和目录。
答案 0 :(得分:0)
使用phonegap,您可以转义所有java代码,如下面的代码所示,您不需要任何Java代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Cordova Menu Button Example</title> <script type="text/javascript" charset="utf-8" src="cordova-2.3.0.js"></script> <script type="text/javascript" charset="utf-8"> // Call onDeviceReady when Cordova is loaded. // At this point, the document has loaded but cordova-2.3.0.js has not. // When Cordova is loaded and talking with the native device, // it will call the event `deviceready`. function onLoad() { document.addEventListener("deviceready", onDeviceReady, false); } // Cordova is loaded and it is now safe to make calls Cordova methods function onDeviceReady() { // Register the event listener document.addEventListener("menubutton", onMenuKeyDown, false); } // Handle the menu button function onMenuKeyDown() { alert("menu btn pressed"); } </script> </head> <body onload="onLoad()"> </body> </html>
不要使用插件来实现此功能,只需转到主documentation即可。 您还可以找到其他事件,如: