Using a font and string as a Drawable

非 Y 不嫁゛ 提交于 2019-12-11 03:14:58

问题


In the spirit of simple vector images on Android that always look sharp, I was wondering if I can't use custom font paired with a string (or a character) as a Drawable.

For instance, if I wanted to use a Webdings character as the drawable on a Button, how would I do this?

I want the best font size to be selected (using dip or sp) so that I get no distortion on the image.

Do you have any ideas how I can accomplish this goal?

Thanks!


回答1:


You can check out my library IconicTextView It allows to use several iconic fonts to display vector images. Currently a subclass of TextView is used to display them but I'm working on rewriting it to use custom Drawable. The main issue here is selecting the best font size, I'm trying to find a way to auto adjust font size.



来源:https://stackoverflow.com/questions/15098468/using-a-font-and-string-as-a-drawable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!