requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); //请求
setContentView(R.layout.custom_title);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title_1); //设置,
前请求然后才能设置。
featureid 有:
| int | DEFAULT_FEATURES | The default features enabled |
| int | FEATURE_CONTEXT_MENU | Flag for the context menu. |
| int | FEATURE_CUSTOM_TITLE | Flag for custom title. |
| int | FEATURE_INDETERMINATE_PROGRESS | Flag for indeterminate progress |
| int | FEATURE_LEFT_ICON | Flag for having an icon on the left side of the title bar |
| int | FEATURE_NO_TITLE | Flag for the "no title" feature, turning off the title at the top of the screen. |
| int | FEATURE_OPTIONS_PANEL | Flag for the "options panel" feature. |
| int | FEATURE_PROGRESS | Flag for the progress indicator feature |
| int | FEATURE_RIGHT_ICON | Flag for having an icon on the right side of the title bar |
| int | ID_ANDROID_CONTENT | The ID that the main layout in the XML layout file should have. |
| int | PROGRESS_END | Ending value for the (primary) progress |
| int | PROGRESS_INDETERMINATE_OFF | Flag for setting the progress bar's indeterminate mode off |
| int | PROGRESS_INDETERMINATE_ON | Flag for setting the progress bar's indeterminate mode on |
| int | PROGRESS_SECONDARY_END | Highest possible value for the secondary progress |
| int | PROGRESS_SECONDARY_START | Lowest possible value for the secondary progress |
| int | PROGRESS_START | Starting value for the (primary) progress |
| int | PROGRESS_VISIBILITY_OFF | Flag for setting the progress bar's visibility to GONE |
| int | PROGRESS_VISIBILITY_ON | Flag for setting the progress bar's visibility to VISIBLE |
自定义窗口标题栏
本文介绍了如何使用Android API来自定义应用程序窗口的标题栏,包括设置自定义标题布局、启用不同特性如进度条和上下文菜单等。通过具体的代码示例展示了如何实现这些功能。
9973

被折叠的 条评论
为什么被折叠?



