在webview中如何把进度条变成进度圈

最近想在程序中设置的进度条改变成进度圈。以下是我的代码:

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);

如何把进度条的格式变成圈呢?请求大家指点一二。谢谢!

2个回答

getWindow().setFeatureInt( Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);

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);
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐