2

I would like to have no title of the Main Activity visible. And at the same time I would like to have in my Home Screen of the phone the application icon with the application name visible. Currently I cannot remove main activity title without removing application name in my Home Screen of the phone.

To be more precise I need a title bar in the Main Activity (so I cannot use @android:style/Theme.NoTitleBar" option). In the title bar I have settings (and it is comfortable to use it there). I would like to remove only the text name.

This is a code in my Android Manifest:

<application
    android:allowBackup="false"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
   <activity
       android:name="org.app.MainActivity"
       android:label="@string/no_title" >
       <intent-filter>
           <action android:name="android.intent.action.MAIN" />
           <category android:name="android.intent.category.LAUNCHER" />
       </intent-filter>
   </activity>

And the code in strings.xml:

<string name="app_name">App Name</string>
<string name="no_title"></string>

Removing line: android:label="@string/no_title", did not work and “App Name” is visible in a title bar of my Main Activity.

Annabelle
  • 734
  • 9
  • 23

2 Answers2

2

Try setting Theme.NoTitleBar to your application.

<activity android:name=".Activity"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.NoTitleBar">
    <intent-filter>
       <action android:name="android.intent.action.MAIN" />
       <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

Source: How disable / remove android activity label and label bar?

Community
  • 1
  • 1
Atul O Holic
  • 6,692
  • 4
  • 39
  • 74
  • Hello, I cannot remove a title bar completely because in the title bar of my main activity I have settings to the application. I would like to remove just a name itself. – Annabelle Feb 19 '14 at 13:55
  • Try - getActionBar().setTitle(R.string.no_title); in your onCreate method of the Activity. – Atul O Holic Feb 19 '14 at 14:01
  • This getActionBar().setTitle(R.string.no_title); removes also the name of the application in my Home Screen of the phone (I see only an icon and I need a name too) – Annabelle Feb 19 '14 at 14:09
  • 1
    try, getActionBar().setDisplayShowTitleEnabled (false); I am just giving all the possibilities we can try here. :) – Atul O Holic Feb 19 '14 at 14:15
  • Hmm this almost work :) Why almost? Becase on activity start I see the title (~0.5 sec) and it disappears. Do you have any more ideas? :) – Annabelle Feb 19 '14 at 14:22
  • I found the soultion! BOTH getActionBar().setDisplayShowTitleEnabled (false); (thank you @Atul O Holic) AND removing android:label="@string/no_title" from the code above! :):):) – Annabelle Feb 19 '14 at 14:29
  • Great :) Would you mind sharing it? and accepting the answer if it helped :) – Atul O Holic Feb 19 '14 at 14:30
  • I found the soultion! BOTH getActionBar().setDisplayShowTitleEnabled (false); (thank you @Atul O Holic) AND removing android:label="@string/no_title" from the code above! :):):) – Annabelle Feb 19 '14 at 14:32
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/47869/discussion-between-atul-o-holic-and-annabelle) – Atul O Holic Feb 19 '14 at 14:38
0

Add this to your activity in your manifest.xml

android:theme="@android:style/Theme.NoTitleBar"

or you can also set it fullscreen by adding this

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

EDIT or in your case:

<activity
       <android:name="org.app.MainActivity"
        android:theme="@android:style/Theme.NoTitleBar"
        android:label="@string/no_title" >
       <intent-filter>
           <action android:name="android.intent.action.MAIN" />
           <category android:name="android.intent.category.LAUNCHER" />
       </intent-filter>
   </activity>
Darko Petkovski
  • 3,892
  • 13
  • 53
  • 117