使用字体和字符串作为可绘制 [英] Using a font and string as a Drawable

查看:142
本文介绍了使用字体和字符串作为可绘制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在简单的矢量图像在Android的精神,总是显得清晰,我想知道如果我不能使用字符串配对的自定义字体(或字符)为可绘制

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.

举例来说,如果我想用一个Webdings字符作为一个按钮可绘制,我会怎么做呢?

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

我要选择最好的字体大小(使用 SP ),使我没有得到任何失真上的图像。

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?

谢谢!

推荐答案

您可以检查出我的图书馆 IconicTextView
它允许使用几个标志性的字体来显示矢量图像。
目前TextView中的一个子类是用来显示他们,但我正在重写它使用自定义绘制对象。
这里的主要问题是选择最佳的字体大小,我试图找到一种方法来自动调整字体大小。

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.

这篇关于使用字体和字符串作为可绘制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆