首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

关于全屏跟取消标题栏

2013-10-08 
关于全屏和取消标题栏------- 源自梦想、永远是你IT事业的好友、只是勇敢地说出我学到! ----------去掉标题

关于全屏和取消标题栏
------- 源自梦想、永远是你IT事业的好友、只是勇敢地说出我学到! ----------


去掉标题栏:

第一种:也一般入门的时候经常使用的一种方法

关于全屏跟取消标题栏关于全屏跟取消标题栏

关于全屏跟取消标题栏


全屏:

第一种

关于全屏跟取消标题栏


关于全屏跟取消标题栏

还有其他的一些对标题栏的设置:

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




------- 源自梦想、永远是你IT事业的好友、只是勇敢地说出我学到! ----------

热点排行