Remove title in Toolbar in appcompat-v7

前端 未结 18 1635
孤街浪徒
孤街浪徒 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:34

    this

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayShowTitleEnabled(false);
        //toolbar.setNavigationIcon(R.drawable.ic_toolbar);
        toolbar.setTitle("");
        toolbar.setSubtitle("");
        //toolbar.setLogo(R.drawable.ic_toolbar);
    

提交回复
热议问题