How to hide the title bar for an Activity in XML with existing custom theme

前端 未结 30 2026
误落风尘
误落风尘 2020-11-22 03:28

I want to hide the titlebar for some of my activities. The problem is that I applied a style to all my activities, therefore I can\'t simply set the theme to @android:

30条回答
  •  一整个雨季
    2020-11-22 03:37

    I'm using a support widget Toolbar v7. So, in order to be able to delete or hide the Title we need to write this.

    Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
    setSupportActionBar(myToolbar);
    
    //Remove¡ing title bar
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    

提交回复
热议问题