Android:requestWindowFeature应用程序窗体显示状态操作

注意requestWindowFeature必须在 setContentView()之前调用。

1.DEFAULT_FEATURES:系统默认状态,一般不需要指定

2.FEATURE_CONTEXT_MENU:启用ContextMenu,默认该项已启用,一般无需指定

3.FEATURE_CUSTOM_TITLE:自定义标题。当需要自定义标题时必须指定。如:标题是一个按钮时

4.FEATURE_INDETERMINATE_PROGRESS:不确定的进度

 requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.test);
setProgressBarIndeterminateVisibility(true);

5.FEATURE_LEFT_ICON:标题栏左侧的图标

requestWindowFeature(Window.FEATURE_LEFT_ICON);
setContentView(R.layout.test);
setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,R.drawable.ic_launcher);

6.FEATURE_NO_TITLE:无标题

requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.test);

7.FEATURE_OPTIONS_PANEL:启用“选项面板”功能,默认已启用。

8.FEATURE_PROGRESS:进度指示器功能

9.FEATURE_RIGHT_ICON:设置标题栏右侧图标

requestWindowFeature(Window.FEATURE_RIGHT_ICON);
setContentView(R.layout.test);
setFeatureDrawableResource(Window.FEATURE_RIGHT_ICON,R.drawable.ic_launcher);
上一篇:Gatling实战(二)


下一篇:Spark——共享变量