mikebai.com

  • Home
  • dev
  • DotNET
  • M365
  • 搞笑
  • 杂七杂八
  • FocusDict
個人BLOG
it developer
  1. Main page
  2. dev
  3. Main content

当webview加载网页的时候在标题栏上显示加载进度

2012-01-30 142hotness 0likes 0comments

ublic class ProgressTest extends Activity{


final Activity context = this;


@Override
public void onCreate(Bundle b) {
   super.onCreate(b);
   requestWindowFeature(Window.FEATURE_PROGRESS);//让进度条显示在标题栏上
   setContentView(R.layout.main);


   WebView webview = (WebView)findViewById(R.id.webview);
   webview.setWebChromeClient(new WebChromeClient() {
              public void onProgressChanged(WebView view, int progress) {
                //Activity和Webview根据加载程度决定进度条的进度大小
               //当加载到100%的时候 进度条自动消失
                context.setProgress(progress * 100);
       }
    });
   webview.loadUrl(url);
}

Tag: Nothing
Last updated:2012-01-30

mikebai

This person is a lazy dog and has left nothing

Like
< Last article
Next article >

COPYRIGHT © 2025 mikebai.com. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang