I'm using the Toolbar (instead of ActionBar) via AppCompat. I'd like to replace the Toolbar's title (the app/actity name) with an icon, but I don't see how.
My icon is just text using a non-standard font, so I guess it might be allowed in Material Design.
Use the following steps in your activity:
Declare the Toolbar object:
Toolbar toolbar = (Toolbar) findViewById(R.id.tool1);
Set the support actionbar:
setSupportActionBar(toolbar);
Remove title:
getSupportActionBar().setDisplayShowTitleEnabled(false);
Add your logo in drawable folder in:
res/drawable.
Add logo using this code:
toolbar.setLogo(R.drawable.ic_launcher);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With