Android在进度条完成加载后隐藏标题栏

时间:2012-08-06 03:18:41

标签: android progress-bar titlebar android-titlebar

我正在尝试在进度条完成加载后隐藏标题栏。谁能告诉我它是如何完成的?谢谢

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


        //this.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); **//Putting this make the whole title bar hidden**
        this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
        this.getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

        setContentView(R.layout.main);

一堆代码......

webView.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 * 100); //Make the bar disappear after URL is loaded

             // Return the app name after finish loading
                if(progress == 100)

             this.requestWindowFeature(Window.FEATURE_NO_TITLE);**//Not Working (shows Error The method requestWindowFeature(int) is undefined for the type new WebChromeClient(){} )**  
              //MyActivity.setTitle(R.string.app_name);

              }



            });
        webView.setWebViewClient(new InsideWebViewClient());


    }

1 个答案:

答案 0 :(得分:2)

您需要在AndroidManifest.xml文件中编写以下语法

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

如果你想通过Activity中的编码来实现它,那么你可以在Activity的OnCreate()方法中使用以下代码。

requestWindowFeature(Window.FEATURE_NO_TITLE); 
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
相关问题