9

I want to hide the titlebar of my app in some of my views. What do I have to add to the layout files I want to hide the titlebar in? Can you provide an example?

Janusz
  • 187,060
  • 113
  • 301
  • 369

5 Answers5

22

Do you mean you want the screen going from something similar to this to something similar to that?

If that's what you want, make your theme inherit Theme.NoTitleBar or use it directly. Your opening Activity tag in the AndroidManifest.xml should look somethig like:

<activity android:name=".MyActivity"
    android:theme="@android:style/Theme.NoTitleBar">

If you only want to hide the title, but keep the title bar, you can go with Sephy's recommendations.

Dimitar Dimitrov
  • 16,032
  • 5
  • 53
  • 55
  • I used this, but afterword my application content disappeared, even thought the GUI is there. Note that I am filling my GUI using DB-manager java class, i.e. reading the content from a DB. what should I do ? – McLan May 15 '14 at 21:31
3

To do it in code you can just add this line of code to the onCreate() method.

requestWindowFeature(Window.FEATURE_NO_TITLE);
Donal Rafferty
  • 19,707
  • 39
  • 114
  • 191
  • 3
    Keep in mind this is not as good as hiding your title via the AndroidManifest.xml, because of the unnecessary showing and hiding of the title bar before calling the onCreate() method: http://developer.android.com/guide/appendix/faq/commontasks.html#configurewindowproperties – Dimitar Dimitrov Mar 15 '10 at 09:36
2

As specified here in accepted answer :

How to hide the title bar for an Activity in XML with existing custom theme

You could use it

<style name="nameOfYourTheme" parent="yourParentTheme">
     <item name="android:windowNoTitle">true</item>
</style>
Community
  • 1
  • 1
Paweł Brewczynski
  • 2,665
  • 3
  • 30
  • 43
0

If you mean the title in the grey bar just below the notification bar, you have to fill the "label" property of the activities you want not to display the application title in your manifest. You can then either define a title for the current activity of simply give an empty string. does it help?

<activity android:name="FirstActivity" android:label="it's title different from application's one"></activity>
Sephy
  • 50,022
  • 30
  • 123
  • 131
0

Whenever I do the suggested changes, and then run rake run:android, each time my AndroidManifest file gets modified to its previous state.

I got the solution as,

Update your build.yml file as

android
  android_title: 0

This worked for me.

Swapnil Chincholkar
  • 2,869
  • 3
  • 22
  • 22