简体   繁体   中英

How to hide application title in Android?

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.

How about this ?

setTitle(""); 

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

通过在活动上调用getActionBar()对您返回ActionBar实例调用setDisplayShowTitleEnabled(false)

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 !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM