Question

I have been trying to do my custom title bar for a week.

I have tried approximately 30 suggestions to achieve that but nothing worked.

I get the you cannot combine custom titles with other title features error every time whatever I try. I can't get rid of this error. This driving me mad.

I have also tried to find a solution by looking for the error on Google. It also did not work.

Here is the code I've tried:

this.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.activity_main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.my_custom_title);

I don't know how to achieve a custom title bar.

Much thanks for helps in advance.

Was it helpful?

Solution

Not the best way to do it in my opinion.

You should do, in res/values/styles.xml, something like:

<style name="AppBaseTheme" parent="...">
    <item name="android:actionBarStyle">@style/mActionBar</item>
</style>

<style name="mActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
        <item name="android:background">...</item>
        <item name="android:icon">...</item>
        <item name="android:titleTextStyle">...</item>
</style>

OTHER TIPS

I recently faced the same error while implementing a custom title bar..."you cannot combine custom titles with other title features"

According to You cannot combine custom title with other title features, Holo's title bar is displayed if the project uses Holo theme.

I stripped my project of all code that uses Holo, and after that my custom title bar displayed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top