TextView 中的特殊字符 [英] Special characters in a TextView

查看:34
本文介绍了TextView 中的特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Android TextView 中显示 "♫" 字符,但它显示的是 [].

I want to show the "♫" character in an Android TextView, but it shows [] instead.

这是我的代码:

txtCatname.setText("♫");

如何正确显示此符号?

推荐答案

您可以使用 Unicode 代码:http://unicode-table.com/en/.

You can use an Unicode code: http://unicode-table.com/en/.

如:

txtCatname.setText("u266b");

或者使用标志性字体,例如 font awesome:
http://fortawesome.github.io/Font-Awesome/

or alternatively use an iconic font, such as font awesome:
http://fortawesome.github.io/Font-Awesome/

如果不支持此字符(并非所有 Unicode 字符都受支持),请使用此替代字体(或您喜欢的任何其他标志性字体).

Use this alternative (or any other iconic font you like), in case this character isn't supported (not all Unicode characters are supported).

这篇关于TextView 中的特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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