Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Custom Title Bar

Tags:

I have a custom title bar

 requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
 setContentView(R.layout.activities);
 getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);

Which works basically fine. The problem is that until the above code is called the default title bar is shown. I don't want a title bar there at all, in other words before mine shows up no title shall show up.

Adding this to the manifest:

<application android:theme="@android:style/Theme.NoTitleBar">

leads to a force close. My manifest looks like this

<application android:icon="@drawable/icon" android:label="@string/app_name"
    android:theme="@style/My_Theme">

Where I need my_Theme since it sets the background color, setting the background color in my customer theme leads to a gray area around my colored backround. So even without the force close I am not sure if the no title will help.

Any idea?

like image 241
paradroid666 Avatar asked Jul 01 '10 12:07

paradroid666


1 Answers

I had the same issue as you.

The issue is with something you have in your style.

Try this out:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="My_Theme">
        <item name="android:windowTitleSize">35dp</item>
        <item name="android:windowTitleBackgroundStyle">@android:color/black</item>
    </style>
</resources>
like image 196
Macarse Avatar answered Dec 17 '22 02:12

Macarse