2012-08-07 176 views
3

目前我的webview有一个进度条。不过,我想删除标题栏,当我这样做时,我再也看不到进度条了。当我将其全屏时,我会得到相同的结果。如果全屏显示,Webview不会显示进度条

这是我在我的onCreate代码:

// Adds Progrss bar Support 
     this.getWindow().requestFeature(Window.FEATURE_PROGRESS); 

     setContentView(R.layout.activity_main); 

     // Setup Webview 
     webView = (WebView) findViewById(R.id.webView1); 
     webView.setVerticalScrollBarEnabled(false); 
     webView.setHorizontalScrollBarEnabled(false); 
     WebSettings webSettings = webView.getSettings(); 
     webSettings.setJavaScriptEnabled(true); 

     // Setting to private class for overriding redirect 
     // Forces the app to use the market app to open 
     final Activity MyActivity = this; 
     webView.setWebChromeClient(new WebChromeClient() { 
      public void onProgressChanged(WebView view, int progress) { 
       MyActivity.setProgress(progress * 100); 
      } 
     }); 
     webView.setWebViewClient(new MyWebViewClient()); 
     webView.loadUrl("http://engadget.com"); 

我怎样才能得到进度条仍然存在,当我使应用程序全屏?

回答

1

嗯,基本上这里就是回答你的问题

Android: The progress bar in the window's title does not display

从上面的链接采取:

如果使用Theme.NoTitleBar(这基本上是你想要做什么)标题栏将不会显示,因为进度栏在标题栏中也不会显示。

而且还对NO_TITLE的使用一些提示可以在这里找到http://www.vogella.com/blog/2011/02/28/android-hidding-the-status-and-title-bar/

而就在想,或许你想使用的,而不是ProgressDialog,这将有可能使用你的NO_TITLE装饰它。


希望它回答你的问题abit。 谢谢