如果是全屏,Webview不会显示进度条

时间:2012-08-07 18:16:47

标签: android webview progress-bar

目前我的网页浏览器有一个进度条。但是我想删除标题栏,当我这样做时,我再也看不到进度条了。当我全屏显示时,我得到相同的结果。

这是我在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 个答案:

答案 0 :(得分: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装饰。


希望它能回答你的问题。 感谢