I have designed a custom title bar for my application. It works well for me too. But there is a problem. The default title is seen (for just a second), before my custom title bar overrides it. Is there any solution to disable the default title bar which android provides?
My codes were like...
window_title.xml in res/layout
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myTitle"
android:text="custom title bar"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="@color/titletextcolor"
android:gravity ="center"/>
color.xml in res/values
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="customTheme" parent="android:Theme">
<item name="android:windowTitleBackgroundStyle">@style/WindowTitleBackground </item>
</style>
</resources>
styles.xml in res/values
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="titlebackgroundcolor">#303010</color>
<color name="titletextcolor">#FFFF00</color>
</resources>
themes.xml in res/values
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="WindowTitleBackground">
<item name="android:background">@color/titlebackgroundcolor</item>
</style>
</resources>
And i had also updated my manifest.xml's activity, as
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.title"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" />
<application
android:icon="@drawable/ic_launcher"
android:theme="@style/customTheme"
android:label="@string/app_name" >
<activity
android:name=".CustomTitleActivity"
android:theme="@style/customTheme" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
and on my onCreate method i had done like..
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.window_title);
final TextView myTitle = (TextView) findViewById(R.id.myTitle);
myTitle.setText("Converter");
And this works well too
I had coded as in http://www.edumobile.org/android/android-programming-tutorials/creating-a-custom-title-bar/
and it works well too..
Is there anyway to disable the default title that comes first?