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

后端 未结 20 2111
傲寒
傲寒 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 18:02

    You can change the style applied to each activity, or if you only want to change the behavior for a specific activity, you can try this:

    setDisplayOptions(int options, int mask) --- Set selected display 
      or
    setDisplayOptions(int options) --- Set display options.
    

    To display title on actionbar, set display options in onCreate()

    getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
    

    To hide title on actionbar.

    getSupportActionBar().setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
    

    Details here.

提交回复
热议问题