How do you remove the title text from the Android ActionBar?

后端 未结 20 2086
傲寒
傲寒 2020-11-29 17:17

I\'m looking through the Holo.Light theme, and I can\'t seem to find the magic style to override to get rid of the title text that briefly shows up when my app

相关标签:
20条回答
  • 2020-11-29 17:50
    getSupportActionBar().setDisplayShowTitleEnabled(false);
        getSupportActionBar().hide();
    

    hope this will help

    0 讨论(0)
  • 2020-11-29 17:50

    Use the following:

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    
    0 讨论(0)
  • 2020-11-29 17:50

    I am new to Android so maybe I am wrong...but to solve this problem cant we just go to the manifest and remove the activity label

    <activity
            android:name=".Bcft"
            android:screenOrientation="portrait"
    
            **android:label="" >**
    

    Worked for me....

    0 讨论(0)
  • 2020-11-29 17:53

    Simply extends your java file from AppCompatActivity and do this:

    ActionBar actionBar = getSupportActionBar(); // support.v7
    actionBar.setTitle(" ");
    
    0 讨论(0)
  • 2020-11-29 17:54

    I tried this. This will help -

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayShowTitleEnabled(false);
    

    getSupportActionBar should be called after setSupportActionBar, thus setting the toolbar, otherwise, NullpointerException because there is no toolbar set. Hope this helps

    0 讨论(0)
  • 2020-11-29 17:54

    as a workaround just add this line incase you have custom action/toolbars

    this.setTitle("");
    

    in your Activity

    0 讨论(0)
提交回复
热议问题