我是Phonegap的新用户,我非常困惑所有工作原理。我已经在c://ProjectName
上创建了项目,并为android构建了该项目。我打开ADT(Eclipse),然后从现有代码创建一个项目,然后有两个项目文件夹:ProjectName和ProjectName-CordovaLib。
第一个问题:
什么是ProjectName-CordovaLib?我是否需要在该文件夹中进行编码?
第二个问题:
我在ProjectName> www文件中,作为Web程序员我很熟悉。
CSS JS IMG和html文件。
当我修改index.html文件并在模拟器中运行该应用程序时,它似乎没有任何作用。在ADT中,自动重建选项被选中。如何修改文件?
在:ProjectName.java
public class ProjectName extends CordovaActivity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.init();
// Set by <content src="index.html" /> in config.xml
super.loadUrl(Config.getStartUrl());
super.loadUrl("file:///android_asset/www/index.html");
}
}
我认为这些是我目前的问题。你能帮我吗?
我的index.html文件(已修改):
<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>MY APP</title>
</head>
<body>
<div class="app">
<h1>MY</h1>
<div id="deviceready" class="blink">
<p class="event listening">Hi !</p>
<p class="event received">Hello Sekai</p>
</div>
</div>
<script type="text/javascript" src="phonegap.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
//there was something here but I deleted it.
// there was an app.init()
</script>
</body>
</html>
最佳答案
First Ans:什么是ProjectName-CordovaLib
? ->这是科尔多瓦图书馆。在oldversion中,phongap将提供.jar,而现在andorid 3.3.0以上将提供一个库。
第二个答案:我在ProjectName>www ->
中拥有在多个平台上使用的基本通用代码,
在Android中,您可以在资产查询中看到www。如果不是,请阅读“ _where-is-www.txt
”文件并按照指示进行操作。
关于android - phonegap中的新手问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22808102/