Android WebView屏幕在加载下一页或同一页时黑屏
问题描述:
我们使用webview制作了三星galaxy选项卡的android应用程序,但当我们点击同一页面或不同页面时,我们在黑屏后4-5秒该屏幕显示该页面。 所以请告诉我,我们为此做了什么,我不想那黑屏。 请为下面的代码找到相同的代码。Android WebView屏幕在加载下一页或同一页时黑屏
CallKiosk.java
package one97.kiosk;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class CallKiosk extends Activity {
public final String url = "http://10.0.8.178:8088/Kiosk/";
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView webview = new WebView(this);
webview.getSettings().setJavaScriptEnabled(true);
webview.setWebViewClient(new WebViewClient());
setContentView(webview);
webview.loadUrl(url);
}
private class MyWebViewClient extends WebViewClient {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return false;
}
}
}
main.xml中
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
AndroidManifest.xml中
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="one97.kiosk"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="8" />
<application android:icon="@drawable/logo" android:label="@string/app_name">
<activity android:name=".CallKiosk"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
答
如果我们试试这个eful,webvieew.setBackgroundColor(“#FFFFFF”)
我想这个黑屏中正在加载页面。只显示进度对话框,并等待页面被加载:) –
尝试这个如果有用的,webvieew.setBackgroundColor(“#FFFFFF”); –