这是我的代码:
getWindow().requestFeature(Window.FEATURE_PROGRESS);
WebView mWebView = (WebView) findViewById(R.id.mywebview);
mWebView.getSettings().setJavaScriptEnabled(true);
final Activity activity = this;
mWebView.setWebChromeClient(new WebChromeClient(){
public void onProgressChanged(WebView view, int progress) {
activity.setTitle("Loading...");
activity.setProgress(progress * 100);
if(progress == 100)
activity.setTitle("My title");
}
});
mWebView.loadUrl(URL);
我想将进度样式更改为圆圈。
如何更改?
答案 0 :(得分:3)
这应该这样做:
getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS); // Request progress circle
setProgressBarIndeterminateVisibility(true); // Show progress circle
WebView mWebView = (WebView) findViewById(R.id.mywebview);
mWebView.getSettings().setJavaScriptEnabled(true);
final Activity activity = this;
mWebView.setWebChromeClient(new WebChromeClient(){
public void onProgressChanged(WebView view, int progress) {
activity.setTitle("Loading...");
activity.setProgress(progress * 100);
if(progress == 100)
setProgressBarIndeterminateVisibility(false); // Hide progress circle when page loaded
activity.setTitle("My title");
}
});
mWebView.loadUrl(URL);
答案 1 :(得分:0)
getWindow().setFeatureInt( Window.FEATUREPROGRESS, Window.PROGRESSVISIBILITY_ON);