Annabelle
Annabelle

Reputation: 754

Application name in home screen of the phone needed but no main activity title

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.

Upvotes: 2

Views: 843

Answers (2)

Darko Petkovski
Darko Petkovski

Reputation: 3912

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>

Upvotes: 0

Atul O Holic
Atul O Holic

Reputation: 6792

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?

Upvotes: 2

Related Questions