Web视图在onPageFinish()之后不呈现页面调用显示空白页面一段时间并呈现页面? - Android

问题描述:

我正在从我的服务器中加载dymanic网页,该网页是在jQuery和NodeJS内部设计的。我一直在WebClient onPageStarted()中加载栏,并在onPageFinished()中删除了它。Web视图在onPageFinish()之后不呈现页面调用显示空白页面一段时间并呈现页面? - Android

但是在调用页面完成之后,仍然不呈现网页,webview显示空白页面一段时间,然后在几秒钟后呈现页面。

同样是与其他网站像谷歌正常工作等

有没有办法,我们设计的网页?

试试这个,

WebView webview = (WebView) findViewById(R.id.webView1); 
     final ProgressDialog pd = ProgressDialog.show(WebPage.this, "", 
       "Loading...", true); 
     webview.getSettings().setLoadWithOverviewMode(true); 
     webview.getSettings().setUseWideViewPort(true); 
     webview.getSettings().setBuiltInZoomControls(true); 
     webview.getSettings().setJavaScriptEnabled(true); 
     webview.setWebViewClient(new WebViewClient() { 
      public void onReceivedError(WebView view, int errorCode, 
        String description, String failingUrl) { 
       Toast.makeText(getApplicationContext(), description, 
         Toast.LENGTH_SHORT).show(); 
      } 

      @Override 
      public void onPageStarted(WebView view, String url, Bitmap favicon) { 
       pd.show(); 
      } 

      @Override 
      public void onPageFinished(WebView view, String url) { 
       pd.dismiss(); 
      } 
     }); 

     webview.loadUrl(yourURL); 
    }