Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to override default title with custom title in android
    text
    copied!<p>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?</p> <p>My codes were like...</p> <p>window_title.xml in res/layout</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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"/&gt; </code></pre> <p>color.xml in res/values</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;style name="customTheme" parent="android:Theme"&gt; &lt;item name="android:windowTitleBackgroundStyle"&gt;@style/WindowTitleBackground &lt;/item&gt; &lt;/style&gt; &lt;/resources&gt; </code></pre> <p>styles.xml in res/values</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;color name="titlebackgroundcolor"&gt;#303010&lt;/color&gt; &lt;color name="titletextcolor"&gt;#FFFF00&lt;/color&gt; &lt;/resources&gt; </code></pre> <p>themes.xml in res/values</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;style name="WindowTitleBackground"&gt; &lt;item name="android:background"&gt;@color/titlebackgroundcolor&lt;/item&gt; &lt;/style&gt; &lt;/resources&gt; </code></pre> <p>And i had also updated my manifest.xml's activity, as</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.title" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="7" /&gt; &lt;application android:icon="@drawable/ic_launcher" android:theme="@style/customTheme" android:label="@string/app_name" &gt; &lt;activity android:name=".CustomTitleActivity" android:theme="@style/customTheme" &gt; &lt;intent-filter &gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>and on my onCreate method i had done like..</p> <pre><code>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"); </code></pre> <p>And this works well too</p> <p>I had coded as in <code>http://www.edumobile.org/android/android-programming-tutorials/creating-a-custom-title-bar/</code> and it works well too..</p> <p>Is there anyway to disable the default title that comes first?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload