简体   繁体   English

将字符串代码转换为字体真棒到 unicode Android

[英]Transforme string code to font awesome to unicode Android

I am using font awesome to show icons in a generate a bottom menu.I receive from server just the correspondent code like f021,我正在使用font awesome在生成底部菜单中显示图标。我从服务器收到的只是对应的代码,如 f021,

I've tried use an escape like \\u .我试过使用像\\u这样的转义符。

    String icon = "\\u"+ feature.getIcon();
    textIcon.setText(icon);

I would like to transform in unicode and use textview.settext("my unicode") .我想转换为 unicode 并使用textview.settext("my unicode")

Here's is the solution that I was looking for:这是我一直在寻找的解决方案:

    long valLong = Long.parseLong(valueUnicodeStr, 16);
    textIcon.setText(String.format("%s", (char) valLong));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM