I am trying to display image before the page is fully loaded in a webView but the webview is displaying blank for few moment and then displaying the desided page the amount of time its showing blank screen i want to display some image.I am using webview inside viewpager.
i have tried onPageStarted,onPageFinished method but without any success.
Here is the code:
web.setWebViewClient(new WebViewClient() {
// load url
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
// when finish loading page
public void onPageFinished(WebView view, String url) {
web.setVisibility(View.VISIBLE);
image.setVisibility(View.GONE);
}
});
<ImageView
android:id="@+id/imageviewloading"
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_gravity="center"
android:layout_weight="1"
android:contentDescription="@string/app_name"
android:src="@drawable/photo_downloading" />
<WebView
android:id="@+id/website"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
</LinearLayout>