In my application, I'm using ActionBarSherlock library. Also I'm using a custom title bar. Here goes my onCreate:
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main_tab);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);
And in my styles.mxl
<style name="MyTheme" parent="Theme.Sherlock">
<item name="android:background">#ff888888</item>
<item name="android:windowNoTitle">false</item>
<item name="android:windowTitleSize">50dp</item>
<item name="android:windowTitleBackgroundStyle">@style/windowTitleBackgroundStyle</item>
</style>
<style name="windowTitleBackgroundStyle">
<item name="android:background">#00688B</item>
</style>
In Manifest file i am using MyTheme for the activity.
android:theme="@style/MyTheme"
This code properly works with lower android version (I have tested with GB2.3.5). But when i tested with ICS, its crashing with the Below error: "You cannot combine custom title with other title features" I went thoroughly in StackOVerflow discussions, but unable to resolve the issue. solutions tried: 1) false 2) there is no values-v11 folder
I received the same exception.
Here is what I found: In newer versions of Android, the framework will use the Window.FEATURE_ACTION_BAR feature whenever the Holo theme is selected. The framework throws the exception whenever an app calls setFeatureInt(Window.FEATURE_CUSTOM_TITLE) and FEATURE_ACTION_BAR has already been set.
In my case, the styles.xml file in the values-v11 folder was redefining my theme to inherit from android:Theme.Holo. When I attempted to run my app on a Android 3.0 or above - it crashed because Holo uses the ActionBar by default. The fix was simple. Turn the ActionBar off when using Holo. Here is the revised values-v11\styles.xml changes:
<style name="AppBaseTheme" parent="android:Theme.Holo.NoActionBar">
<!-- API 11 theme customizations can go here. -->
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With