This is my code :
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..."开发者_如何学JAVA);
activity.setProgress(progress * 100);
if(progress == 100)
activity.setTitle("My title");
}
});
mWebView.loadUrl(URL);
I want to change the progress style to a circle.
How to change it?
This should do it:
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);
getWindow().setFeatureInt( Window.FEATUREPROGRESS, Window.PROGRESSVISIBILITY_ON);
精彩评论