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

IconDrawable with "text {mdi-plus}" #160

Closed willstdueswissen closed 8 years ago

willstdueswissen commented 8 years ago

Simple Question: Is any stuff avaible to use new IconDrawable(this, "text {mdi-plus}")

Or is a chance avaible to create own view? I would have a FAB and some other stuff

Thank you!

Logan676 commented 8 years ago

+1

JoanZapata commented 8 years ago

You can't use IconDrawable that way, but I think an IconTextView would let you do exactly what you need.

willstdueswissen commented 8 years ago

No IconTextView can not be set to costome views with a simple canvas or on a FAB (Floating Action Button)

JoanZapata commented 8 years ago

Ok I misunderstood you're first message. You can't use Iconify for this. A FAB is basically an imageview so you can't provide it text + images.

About your custom view, I obviously can't guess what class you're extending but consider extending a ViewGroup so that you can add an IconTextView in it.

willstdueswissen commented 8 years ago

but if you render with IconDrawable the text to image (you can also name it to: IconTextDrawable), you can use it on all views.

JoanZapata commented 8 years ago

I'm not saying its not possible at all, I'm saying that Iconify won't support it. It would add unnecessary complexity to the lib for a not-so-common use case.

You can create an IconTextDrawable in your project and rely on Iconify for its implementation though. I think you'd have to create an IconTextView internally, set it's text, make sure it's measured properly, and then pass him the canvas of the Drawable like iconTextView.draw(canvas) when you need to draw it.

TL;DR Iconify won't allow a IconDrawable with both text and icons out of the box. An IconDrawable is a single icon in a Drawable.