How disable / remove android activity label and label bar?

Android

Android Problem Overview


Is there anyway to remove activity label bar and label itself which is set by default from application label? I'd like to have whole layout from my design and need to remove the label bar and label which is in TOP layout.

Android Solutions


Solution 1 - Android

You can achieve this by setting the android:theme attribute to @android:style/Theme.NoTitleBar on your <activity> element in your AndroidManifest.xml like this:

<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>

Solution 2 - Android

If your application theme is AppTheme(or anything else), then in styles.xml add the following code:

<style name="HiddenTitleTheme" parent="AppTheme">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
 </style>

Then in manifest file add the following in the activity tag for which you want to disable activity label:

android:theme="@style/HiddenTitleTheme"

Solution 3 - Android

public void onCreate(Bundle savedInstanceState) {  
        super.onCreate(savedInstanceState);  

        //set up notitle 
        requestWindowFeature(Window.FEATURE_NO_TITLE);  
        //set up full screen
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,   
                WindowManager.LayoutParams.FLAG_FULLSCREEN);  

        setContentView(R.layout.main);  
} 

Solution 4 - Android

I am not 100% sure this is what you want but if you are referring to the title bar (the little gray strip at the top), you can remove/customize it via your manifest.xml file...

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

Solution 5 - Android

you can try this

 ActionBar actionBar = getSupportActionBar();
        actionBar.setDisplayShowTitleEnabled(false);

Solution 6 - Android

You have two ways to hide the title bar by hiding it in a specific activity or hiding it on all of the activity in your app.

You can achieve this by create a custom theme in your styles.xml.

<resources>
    <style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
</resources>

If you are using AppCompatActivity, there is a bunch of themes that android provides nowadays. And if you choose a theme that has .NoActionBaror .NoTitleBar. It will disable you action bar for your theme.

After setting up a custom theme, you might want to use the theme in you activity/activities. Go to manifest and choose the activity that you want to set the theme on.

SPECIFIC ACTIVITY

AndroidManifest.xml

<application
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name">

    <activity android:name=".FirstActivity"
        android:label="@string/app_name"
        android:theme="@style/MyTheme">
    </activity>
</application>

Notice that I have set the FirstActivity theme to the custom theme MyTheme. This way the theme will only be affected on certain activity. If you don't want to hide toolbar for all your activity then try this approach.

The second approach is where you set the theme to all of your activity.

ALL ACTIVITY

<application
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/MyTheme">

    <activity android:name=".FirstActivity"
        android:label="@string/app_name">
    </activity>
</application>

Notice that I have set the application theme to the custom theme MyTheme. This way the theme will only be affected on all of activity. If you want to hide toolbar for all your activity then try this approach instead.

Solution 7 - Android

There is a code here that does it.

The trick is at this line:

 title.setVisibility(View.GONE);

Solution 8 - Android

There's also a drop down menu in the graphical layout window of eclipse. some of the themes in this menu will have ".NoTitleBar" at the end. any of these will do trick.

Solution 9 - Android

In my case, the others answers was not enough...

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowFullscreen">true</item> 
</style>

<application
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
</application>

Tested on Android 4.0.3 API 15.

Solution 10 - Android

Whenever I do rake run:android,

my Androidmenifest.xml file is built-up again so my changes done

for NoTitlebar no more persist.

Rather than user adroid_title: 0

This helped me.

edit your build.yml

android:
android_title: 0
#rest of things
#you needed

Solution 11 - Android

This one.

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

Solution 12 - Android

you can use this in your activity tag in AndroidManifest.xml to hide label

android:label=""

Solution 13 - Android

IF you are using Android Studio 3+ This will work: android:theme="@style/Theme.AppCompat.NoActionBar"

@android:style/Theme.NoTitleBar will not support in new API and force you app close.

Solution 14 - Android

with your toolbar you can solve that problem. use setTitle method.

 Toolbar   mToolbar = (Toolbar) findViewById(R.id.toolbar);
  mToolbar.setTitle("");
  setSupportActionBar(mToolbar);

super easy :)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionFarenView Question on Stackoverflow
Solution 1 - AndroidOctavian A. DamieanView Answer on Stackoverflow
Solution 2 - AndroidMd.View Answer on Stackoverflow
Solution 3 - AndroidLi CheView Answer on Stackoverflow
Solution 4 - AndroidAndrew WhiteView Answer on Stackoverflow
Solution 5 - AndroidMuhammad MuqorrobinView Answer on Stackoverflow
Solution 6 - AndroidUmarZaiiView Answer on Stackoverflow
Solution 7 - AndroidAliostadView Answer on Stackoverflow
Solution 8 - AndroidSiavashView Answer on Stackoverflow
Solution 9 - AndroidPhilip EncView Answer on Stackoverflow
Solution 10 - AndroidSwapnil ChincholkarView Answer on Stackoverflow
Solution 11 - AndroidstackoverflowView Answer on Stackoverflow
Solution 12 - AndroidQazi FirdousView Answer on Stackoverflow
Solution 13 - AndroidHarish KumarView Answer on Stackoverflow
Solution 14 - AndroidReza RvView Answer on Stackoverflow