How do I remove the title bar from my app?

AndroidAndroid Layout

Android Problem Overview


In my app there is this title bar at the top where the overflow menu would be, but I don't need settings and only have one screen. When I change the theme like described in many other questions I get the old 2.2 theme. I want to have the modern theme just without the bar at the top.

Android Solutions


Solution 1 - Android

Go to styles.xml and change .DarkActionBar for .NoActionBar

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
</style>

becomes

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

if colors are irrelevant to your app, you can actually go for

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar" />

Solution 2 - Android

In the manifest file Change:

    android:theme="@style/AppTheme" >
    android:theme="@style/Theme.AppCompat.NoActionBar"

Solution 3 - Android

this.requestWindowFeature(Window.FEATURE_NO_TITLE);

works in onCreate() when put before setContentView() is invoked.

otherwise it crashes

Solution 4 - Android

Check this

 ActionBar actionBar = getSupportActionBar();
    actionBar.hide();

Solution 5 - Android

In styles.xml file, change DarkActionBar to NoActionBar

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

Solution 6 - Android

Go to Project -> app -> main -> res -> values -> styles.xml

Change this line if you want to delete it for every view

 `<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">`

to

 `<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">`

if you want to make it just for one view you can change it in youre manifest data. Go to Android -> manifests -> AndroidManifest.xml. do following:

  1. Search the View you want to get this type of change <activity android:name"...">
  2. Add android:theme=""@style/Theme.AppCompat.NoActionBar"

Solution 7 - Android

This works for me

getSupportActionBar().hide();

Solution 8 - Android

This was working for me on values/styles.xml add items:

       `<item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>`
  

Solution 9 - Android

In the manifest file change to this:

android:theme="@style/Theme.AppCompat.Light.NoActionBar" >

Solution 10 - Android

For Beginner Like Me. Just Do it what I say.From your Android Project.

app -> res -> values -> style.xml

replace this code

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

</resources>

Enjoy.

Solution 11 - Android

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

    getSupportActionBar().hide();

    setContentView(R.layout.activity_main);

Just simply put getSupportActionBar().hide(); between super.onCreate and setContentView method.

Solution 12 - Android

  1. open styles.xml
  2. insert

>

you can change name="---------"

  1. open Androidmaifest.xm

    find android:theme="@style/AppTheme" chang to android:theme="@style/no_title"

  2. click select Theme on menubar (it's green color near MainActivity)

    • click project Theme
    • click no_title (on you right hand Side)
    • click OK

Solution 13 - Android

do this in you manifest file:

<application 
    android:icon="@drawable/icon" 
    android:label="@string/app_name" 
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen">

Solution 14 - Android

delete the following from activity_main.xml

<android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.PopupOverlay"/>

contact me for more help

Solution 15 - Android

this.requestWindowFeature(Window.FEATURE_NO_TITLE);

in onCreate() works!

Solution 16 - Android

Try changing styles to NoActionBar if that doesn't works add this code to your main activity

 protected void onCreate(Bundle savedInstanceState) {
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        super.onCreate(savedInstanceState);
        ActionBar actionBar = getSupportActionBar();
        actionBar.hide();
        setContentView(R.layout.activity_main);
        
    }

Solution 17 - Android

This works for me i hope this work for you as well

protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
	setContentView(R.layout.activity_main);
}

Solution 18 - Android

In Kotlin, this is how to do.

val actionBar: ActionBar? = supportActionBar
    actionBar?.hide()

Solution 19 - Android

Best way is to use actionbar function setTitle() if you wish to show logo or have some other stuff in you actionBar but dont want to see name of the app, write this code in MainActivity.java or anywhere you wish to hide title in onCreate:

android.support.v7.app.ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setIcon(R.mipmap.full_white_logo_m); // display logo
actionBar.setTitle(""); // hide title

This way your app won't have reason to crash.

Solution 20 - Android

Just use setTitle(null) above

toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

The title will disappear then you can use the logo of your choice.....

Solution 21 - Android

The easiest way: Just double click on this button and choose "NoTitleBar" ;)

Click here to see where it is :)

Solution 22 - Android

I have faced the same problem as you, and solve this problem just by changing the class which I extended.

//you will get the app that does not have a title bar at the top.
import android.app.Activity;
public class MainActivity extends Activity
{}

//you will get the app that has title bar at top
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity
{}

I hope this will solve your problem.

Solution 23 - Android

In AndroidManifest.xml of your application you'll find the android:theme for example set to @style/AppTheme

Now go to styles.xml, find the style tag, make sure that name is set to AppTheme the same as in manifest and set parent to android:Theme.Holo.Light.NoActionBar (also do this in styles(v21) if you have it in your project)

<style name="AppTheme" parent="android:Theme.Holo.Light.NoActionBar">
    <!-- ... -->
</style>

Solution 24 - Android

Just call setTitle(null); in onCreate()

Solution 25 - Android

try: toolbar.setTitle(" ");

@Override
protected void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = findViewById(R.id.toolbar);
    toolbar.setTitle("");
    setSupportActionBar(toolbar);
}

Solution 26 - Android

To simply remove the title bar (which means the bar contains your app name) from an activity, I simply add below line to that activity in the manifests\AndroidManifest.xml:

android:theme="@style/AppTheme.NoActionBar"

It should now look like below

<activity
  android:name=".MyActivity"
  android:theme="@style/AppTheme.NoActionBar"></activity>

Hope it'll be useful.

Solution 27 - Android

Newer versions replaced styles.xml with themes.xml

Go to Project -> app -> res -> values -> themes -> themes.xml

and change e.g.

<style name="Theme.MyApplication" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
    <!-- omitted for brevity -->
</style>

to

<style name="Theme.MyApplication" parent="Theme.MaterialComponents.DayNight.NoActionBar">
    <!-- omitted for brevity. -->
</style>

Switching the parent to NoActionBar

Do this for both themes.xml files

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
QuestionJonasView Question on Stackoverflow
Solution 1 - AndroidMr. TorresView Answer on Stackoverflow
Solution 2 - AndroidTarek Ezzat AbdallahView Answer on Stackoverflow
Solution 3 - AndroidIvo RobotnikView Answer on Stackoverflow
Solution 4 - AndroidManmohan KumarView Answer on Stackoverflow
Solution 5 - AndroidKamesh Kumar SinghView Answer on Stackoverflow
Solution 6 - AndroidZitroView Answer on Stackoverflow
Solution 7 - AndroidB.ÖNERView Answer on Stackoverflow
Solution 8 - AndroidRoger CasagrandeView Answer on Stackoverflow
Solution 9 - AndroidXIIIView Answer on Stackoverflow
Solution 10 - AndroidMD JULHAS HOSSAINView Answer on Stackoverflow
Solution 11 - AndroidAzizul HakimView Answer on Stackoverflow
Solution 12 - Androidสาธิต งามเมืองView Answer on Stackoverflow
Solution 13 - AndroidRustamView Answer on Stackoverflow
Solution 14 - AndroidClaudeView Answer on Stackoverflow
Solution 15 - AndroidJonasView Answer on Stackoverflow
Solution 16 - AndroidRajaSekarView Answer on Stackoverflow
Solution 17 - AndroidShehrozEKView Answer on Stackoverflow
Solution 18 - AndroidKimanthi K.View Answer on Stackoverflow
Solution 19 - AndroidPerhpethuaView Answer on Stackoverflow
Solution 20 - AndroidBhupinder SinghView Answer on Stackoverflow
Solution 21 - AndroidAnnemarie RinyuView Answer on Stackoverflow
Solution 22 - AndroidTee Yi HengView Answer on Stackoverflow
Solution 23 - AndroidAyham RustomView Answer on Stackoverflow
Solution 24 - AndroidMina FawzyView Answer on Stackoverflow
Solution 25 - AndroidKhaledView Answer on Stackoverflow
Solution 26 - AndroidGregorioView Answer on Stackoverflow
Solution 27 - AndroiddogView Answer on Stackoverflow