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,无法分别进行设置。


更多相关文章

  1. OpenGL,Android注意事项初始化顺序 NullPointer
  2. android各种声音类型级数设定及默认值
  3. Android百度地图(五):百度地图鹰眼sdk监控进出地理围栏(区域)
  4. 4.2.2.5 Android如何检测网络的类型为3G、2G、wap、wifi
  5. Android中关于线程使用的几点注意事项
  6. android中求区域内两个坐标之间的距离的实现

随机推荐

  1. Android图形图画学习(1)
  2. 学习android的好博客
  3. Android新建项目后src下没有自动生成文件
  4. 跟Google学习Android开发-起始篇-保存数
  5. 【Android游戏开发二十二】(图文详解)游戏
  6. 《今日求职》之拉勾网Android客户端产品
  7. Android(安卓)编译文件使其支持wml
  8. android消息处理机制原理解析
  9. Android(安卓)studio Error:(30, 31) 错
  10. [置顶] Android(安卓)轻松实现后台搭建+A