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

查看:219
本文介绍了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");

或使用图标字体,例如真棒字体:
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天全站免登陆