这里来自ABS示例进度条的代码根据网页加载使用ActionBar
ProgressBar
进行更新,事情是进度条在页面加载之前完成。任何人都可以帮忙更正此代码吗?
private int mProgress = 100;
private Handler mHandler = new Handler();
private Runnable mProgressRunner = new Runnable() {
@Override
public void run() {
mProgress += 1;
//Normalize our progress along the progress bar's scale
int progress = (Window.PROGRESS_END - Window.PROGRESS_START) / 100 * mProgress;
setSupportProgress(progress);
if (mProgress < 100) {
mHandler.postDelayed(mProgressRunner, 50);
}
}
};
mWebView.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int progress) {
if (mProgress == 100) {
mProgress = 1;
setSupportProgressBarIndeterminateVisibility(false);
mProgressRunner.run();
} else {
setSupportProgressBarIndeterminateVisibility(true);
}
}
});