Android 将自定义标题与功能进度相结合

Android 将自定义标题与功能进度相结合,android,android-layout,android-titlebar,Android,Android Layout,Android Titlebar,在我的onCreate()中,我设置了一个进度条,如下所示: getWindow().requestFeature(Window.FEATURE_PROGRESS); getWindow().setFeatureInt( Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON); 现在,我想稍微增强一下标题栏,我想改变它的颜色。第一步是检查是否支持FEATURE\u CUSTOM\u TITLE: final boolean customT

在我的onCreate()中,我设置了一个进度条,如下所示:

getWindow().requestFeature(Window.FEATURE_PROGRESS);
getWindow().setFeatureInt( Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);
现在,我想稍微增强一下标题栏,我想改变它的颜色。第一步是检查是否支持
FEATURE\u CUSTOM\u TITLE

final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
if ( customTitleSupported ) {
    Log.i(TAG, "CUSTOM TITLE SUPPORTED!")
}
但是当我调用
requestWindowFeature(Window.FEATURE\u CUSTOM\u TITLE)
时,我得到一个:

AndroidRuntimeException: You cannot combine custom titles with other title features
(无论是在设置
FEATURE\u PROGRESS
之前还是之后调用此函数)

你知道怎么做吗

或者,如果我能找到非自定义标题栏的资源,我会避免使用标题栏。比危险的东西更好的东西

这可能吗?

如下所示:

功能\自定义\标题

自定义标题的标志。你不能把这两者结合起来 具有其他标题功能的功能

正如您所提到的,您可以将自定义标题栏与ProgressBar一起使用


另一方面,你为什么不使用Action Bar?

,因为Action Bar只在Android 3.0+中出现,我也需要在2.x上运行。