[android] How disable / remove android activity label and label bar?

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.

This question is related to android

The answer is


you can try this

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

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.


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

android:label=""

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"

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

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.


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.


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);  
} 

This one.

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

There is a code here that does it.

The trick is at this line:

 title.setVisibility(View.GONE);

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 

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.


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

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

super easy :)