Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • Wouldn't it get fired when clicking on empty spaces in the toolbar? Commented Nov 4, 2015 at 12:57
  • It will, but that space would be filled by a textview with MATCH_PARENT as well... it's fine for my usecases...
    – prom85
    Commented Nov 4, 2015 at 13:00
  • @prom85 how do you add the textview with h match_parent? if I add a view with match_parent it will cover the title.
    – amarkovits
    Commented Nov 11, 2015 at 15:23
  • I did this as I wanted to use this text view instead of a title . If you don't need the text view don't use it? Or do you need it?
    – prom85
    Commented Nov 11, 2015 at 15:31
  • 2
    This is a great solution. There is no need to add anything to the xml for the toolbar, i.e. no need for TextView or ImageView. What I did was to set a logo with getSupportActionBar().setLogo(R.drawable.jclogo);, make it clickable: toolbar.setClickable(true);, followed by the code above and it works perfect. Thank you @prom85 Commented Aug 10, 2017 at 9:30