JoanZapata / android-iconify

Android integration of multiple icon providers such as FontAwesome, Entypo, Typicons,...
http://joanzapata.com/android-iconify
Other
3.93k stars 527 forks source link

[Question] Setting Toolbar menu item via XML #136

Closed Plastix closed 8 years ago

Plastix commented 8 years ago

The readme has the following code:

// Set an icon in the ActionBar
menu.findItem(R.id.share).setIcon(
   new IconDrawable(this, FontAwesomeIcons.fa_share)
   .colorRes(R.color.ab_icon)
   .actionBarSize());

Is there a way to do this with XML using the support library toolbar?

JoanZapata commented 8 years ago

I don't think so, you could probably put an IconTextView in the Toolbar directly in your layout file, but you'd loose some of the advantages of using a Toolbar. For example, the Toolbar wouldn't be able to adjust to smaller screen sizes by putting extra items in an overflow menu.

Plastix commented 8 years ago

Thanks for the explanation!