Remove title in Toolbar in appcompat-v7

前端 未结 18 1409
孤街浪徒
孤街浪徒 2020-12-07 09:52

The documentation of Toolbar says

If an app uses a logo image it should strongly consider omitting a title and subtitle.

18条回答
  •  有刺的猬
    2020-12-07 10:45

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

    take note of this line getSupportActionBar().setDisplayShowTitleEnabled(false);

提交回复
热议问题