我开发了一个Android应用程序,其中我同时使用phonegap和Android Native.Where它加载phonegap www文件夹它加载通过首先显示黑屏2秒然后白屏6-7秒是有任何方式摆脱这个黑白屏幕?如果它是如何?我用Google搜索并使用下面链接中的东西,但没有用(这些是在启动时加载应用程序时解决)
How To fix white screen on app Start up?
Why there is a white screen appears for 1sec when starting to run the apps in Android?
How to remove white screen while loading android application?
我正在使用以下代码加载www文件夹数据
public class webActivity extends DroidGap {
public static String urlpath;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo wifiNetwork = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
NetworkInfo mobileNetwork = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
if ((wifiNetwork != null && wifiNetwork.isConnected()) || (mobileNetwork != null && mobileNetwork.isConnected())) {
super.setStringProperty("loadingDialog", "Please Wait,Loading...");
super.loadUrl("file:///android_asset/www/reqpage.html?lat="+Activity.latitude+"&long="+Activity.longitude);
}
else{
final AlertDialog alertDialog = new AlertDialog.Builder(
webActivity.this).create();
alertDialog.setTitle("Warning");
alertDialog.setMessage("No network available,<br/>Please check your connectivity.");
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(webActivity.this, Activity.class);
startActivity(intent);
}
});
alertDialog.show();
}
}