关于phonegap

时间:2023-03-10 00:18:46
关于phonegap

phonegap安卓环境搭建:

http://www.cnblogs.com/Random/archive/2011/12/28/2305398.html
http://ningtukun.blog.163.com/blog/static/18654144520135213526601/

1 设置安卓应用程序图标

在AndroidManifest.xml内找到application中的android:icon即可。

关于phonegap

修改icon为自己想要修改的图片的id即可。

2 在项目内部打开外部连接:
res-xml-config.xml
添加:<access origin="http://*"/>

3 在项目中打开外部连接:

res-xml-config.xml
添加:<access origin="http://127.0.0.1*"/>

4 设置启动图片:主程序中的代码如下所示:

package com.cn.testproject;

import android.os.Bundle;
import android.view.Menu; import org.apache.cordova.*; public class MainActivity extends DroidGap { @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setIntegerProperty("splashscreen", R.drawable.startup_bg);
super.loadUrl("file:///android_asset/www/index.html",5000);//后面的这个参数一定要加~否则不会显示启动图片。
} @Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}