How to hide application title in Android?

559 Views Asked by At

I want to create an application with just the app icon on the title bar and no app name. How can I do it?

I have tried to use:

requestWindowFeature(Window.FEATURE_NO_TITLE);

but it just removes the title bar and not just the application name.

3

There are 3 best solutions below

3
On BEST ANSWER

Call setDisplayShowTitleEnabled(false) on the ActionBar instance you get back by calling getActionBar() on your activity.

1
On

How about this ?

setTitle(""); 

...in onCreate() of any Activity whose title should be empty. (Or in onCreateView() of any Fragment: getActivity().setTitle("");)

2
On

I am not opposing , Sir ( Jonik/CommonsWare ) answer , but by doing getActivity().setTitle("") & setDisplayShowTitleEnabled(false) you will see app title at the creation of the Activity , i think .

but if you perform Sir ( Jonik/CommonsWare ) answer like this , then it will be better

public void onWindowFocusChanged(boolean hasFocus) {

            super.onWindowFocusChanged(hasFocus);

          if(hasFocus) 
             getActionBar().setDisplayShowTitleEnabled(false);
    } 

Sorry if , it doesnt help you !