5
在我的onCreate()我设置一个进度条如下:结合自定义标题与FEATURE_PROGRESS
getWindow().requestFeature(Window.FEATURE_PROGRESS);
getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);
现在,希望以增强标题栏一点点,我想改变它的颜色background。第一步就是要检查是否支持FEATURE_CUSTOM_TITLE
:
final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
if (customTitleSupported) {
Log.i(TAG, "CUSTOM TITLE SUPPORTED!")
}
但只要我称之为requestWindowFeature(Window.FEATURE_CUSTOM_TITLE)
我得到一个:
AndroidRuntimeException: You cannot combine custom titles with other title features
(如果设置之前调用此函数没关系FEATURE_PROGRESS
或之后)
任何想法如何work around这?
或者,我会避免custom标题栏,如果我能找到非自定义标题栏的资源ID。有些东西比危险的getParent()好。
这可能吗?
因为'ActionBar'只存在于Android 3.0+中,所以我需要在2.x上运行。 – ateiob
@ateiob对于2.x及以上您可以使用ActionBarSherlock http://abs.io – eveliotc