How to hide app name from title bar in Android?

17,248

Solution 1

You have to call `

getSupportActionBar().setDisplayShowTitleEnabled(false) - to hide it,

or

getSupportActionBar().setTitle("new title"); - if you want to change it

Solution 2

Kinda "workaround", but it's working fine:

In the Manifest

<activity
        android:name=".YourActivity"
        android:label="" />

Solution 3

You can use getSupportActionBar. if you want to hide just your app name use this code in Activity of that page :

getSupportActionBar().setDisplayShowHomeEnabled(false);
   

And if you want to hide ActionBar use this

getSupportActionBar().hide();

And you can ReName your app with :

getSupportActionBar().setTitle("that name you want");

Totaly you can use:

getSupportActionBar().

and others code ...

Solution 4

If you want to do this outside of the code, put this in your manifest:
<activity android:name=".ActivityName" android:theme="@android:style/Theme.NoTitleBar">

edit: ranjith beat me to it.

Solution 5

In Kotlin you can use:

supportActionBar?.setDisplayShowTitleEnabled(false)

The "?" is important because you can have the whole title bar disabled already because you try to set a a not existing title bar's title status to false.

Share:
17,248
khawar
Author by

khawar

Updated on July 07, 2022

Comments

  • khawar
    khawar almost 2 years

    My app is showing name and icon. I want to hide name.

    How i can do that?

    enter image description here

  • Andy Weinstein
    Andy Weinstein almost 5 years
    This is the solution if you don't want the title but you want to be able to have a menu - even if it's just a single icon. I had code that worked with an icon-menu-item in another activity and wanted to reuse it here. Would have been a lot of extra code to write it as a button.