dismiss()
在加载webview后,我需要对代码进行对话才能生成什么内容?
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); CookieSyncManager.createInstance(this); CookieSyncManager.getInstance().startSync(); webview = (WebView) findViewById(R.id.webview); webview.setWebViewClient(new homeClient()); webview.getSettings().setJavaScriptEnabled(true); webview.getSettings().setPluginsEnabled(true); webview.loadUrl("http://google.com"); ProgressDialog pd = ProgressDialog.show(Home.this, "", "Loading. Please wait...", true); }
我试过了
public void onPageFinshed(WebView view, String url){ pd.dismiss(); }
没工作.
:o webview.setWebViewClient(new homeClient()); homeClient() ????
试试这个
... ... ... webview = (WebView) findViewById(R.id.webview); webview.setWebViewClient(new WebViewClient() { public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } public void onPageFinished(WebView view, String url) { if (progressBar.isShowing()) { progressBar.dismiss(); } } webview.loadUrl("http://www.google.com"); }
更新:: 这是一个很好的例子.
Android WebView和不确定进度解决方案