我得到了在web視圖中顯示活動指示器的代碼。我檢查了多個參考文獻,但仍然無法正常工作。你能幫我調試我的代碼嗎?android webview客戶端活動指示器
活性指示器不與下面的代碼來下面代碼
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
final BaseActivity MyActivity = ReviewWebActivity.this;
setContentView(R.layout.review_web);
getWindow().setFeatureInt(Window.FEATURE_PROGRESS,
Window.PROGRESS_VISIBILITY_ON);
ScannedProduct product = getReviewUrl();
reviewUrl = product.getReviewLink();
if (reviewUrl == null) {
String err = product.getErrorCode();
if(err.equals("")) err ="No Data Available for this product";
Toast.makeText(getApplicationContext(),
"No Data Available for this product", 1).show();
return;
}
webReview = (WebView) findViewById(R.id.webReview);
webReview.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
// Make the bar disappear after URL is loaded, and changes
// string to Loading...
MyActivity.setTitle("Loading...");
MyActivity.setProgress(progress * 1000); // tried with 100 also
}
});
webReview.setWebViewClient(new ReviewWebClient());
webReview.getSettings().setJavaScriptEnabled(true);
webReview.loadUrl(reviewUrl);
}
非常感謝你 – png 2012-02-16 12:42:36
ChromeClient類中沒有進度對象 – Rajan 2015-10-17 22:36:37