ate*_*iob 5 android android-layout android-titlebar
在我的onCreate()中,我设置了一个进度条,如下所示:
getWindow().requestFeature(Window.FEATURE_PROGRESS);
getWindow().setFeatureInt( Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);
Run Code Online (Sandbox Code Playgroud)
现在,希望稍微增强标题栏,我想改变它的背景颜色.第一步是检查是否FEATURE_CUSTOM_TITLE支持:
final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
if ( customTitleSupported ) {
Log.i(TAG, "CUSTOM TITLE SUPPORTED!")
}
Run Code Online (Sandbox Code Playgroud)
但是一旦我打电话给requestWindowFeature(Window.FEATURE_CUSTOM_TITLE)我得到一个:
AndroidRuntimeException: You cannot combine custom titles with other title features
Run Code Online (Sandbox Code Playgroud)
(如果我在设置之前FEATURE_PROGRESS或之后调用此函数无关紧要)
知道如何解决这个问题吗?
或者,如果我能找到非自定义标题栏的资源ID,我会避免使用自定义标题栏.比危险的getParent()更好的东西.
这可能吗?
正如文档所说:
FEATURE_CUSTOM_TITLE
自定义标题的标志。您不能将此功能与其他游戏功能结合使用。
正如您提到的,您可以做的是使用带有进度条的自定义标题栏,这里是如何实现这一点的示例。
另一方面,为什么不使用操作栏?
| 归档时间: |
|
| 查看次数: |
1440 次 |
| 最近记录: |