1、隱藏標題列
requestWindowFeature(Window.FEATURE_NO_TITLE);
2、在標題列顯示進度條
requestWindowFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.progressbar_1);
setProgressBarVisibility(true);
final ProgressBar progressHorizontal = (ProgressBar) findViewById(R.id.progress_horizontal);
setProgress(progressHorizontal.getProgress() * 100);
setSecondaryProgress(progressHorizontal.getSecondaryProgress() * 100);
3、使用自訂標題列
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.xxx);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.my_title_bar);
4、清除標題列內容,而地區保留
((ViewGroup) getWindow().findViewById(com.android.internal.R.id.title_container)).removeAllViews();
5、隱藏標題列
((ViewGroup)getWindow().
findViewById(com.android.internal.R.id.title_container)).setVisibility(View.GONE);
6、顯示標題列
...setVisibility(View.VISIBLE);
其他注意事項
(1) requestWindowFeature()要在setContentView()之前調用;
(2) 設定各種Feature,是具有排它性的,一旦設定,後續不可更改為別的類型;
(3) 當使用TabHost(由ActivityGroup派生)時,各個Tab裡的Activity,要麼都是NO_TITLE,要麼都是CUSTOM_TITLE,無法分別進行設定。