Android标题栏的各种设置

1、隐藏标题栏
requestWindowFeature(Window.FEATURE_NO_TITLE);
2、在标题栏显示进度条
requestWindowFeature(Window.FEATURE_PROGRESS);setContentView(R.layout.progressbar_1);
setProgressBarVisibility(true);

finalProgressBarprogressHorizontal=(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,是具有排它性的,一旦设置,后续不可更改为别的类型;

更多相关文章

  1. 字符数组表示字符串的注意事项是什么
  2. 疫情防控不能松懈,利用数据挖掘做好重点区域人群密度预测
  3. php命名格式注意事项(详解)
  4. PHP判断点是否在多边形区域内外
  5. IPython高级用法及注意事项
  6. Java 中的锁如何使用?有什么注意事项?
  7. java运行时数据区域
  8. 服务端开发指南与最佳实战 | 数据存储技术 | MySQL(04) 索引使用的
  9. [jquery]如何实现页面单块DIV区域滚动展示

随机推荐

  1. 鸿洋博客精选
  2. android 预装第三方apk的方法
  3. 简述compileSdkVersion,minSdkVersion,targ
  4. unity3d android真机测试的2种方法
  5. Android(安卓)基础入门教程——开发环境
  6. Android(安卓)RecyclerView单击、长按事
  7. Android系统中读写和显示图片
  8. Android(安卓)PopupWindow输入框弹起时被
  9. EventBus
  10. FFmpeg之一编译ForAndroid