标和下标在Android应用程序的XML [英] Superscript and Subscript in Android App XML

查看:141
本文介绍了标和下标在Android应用程序的XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从有在其中标和上标字符,这是我从字符映射了一个XML文件par​​cing数据。像这样:

I am parcing data from an XML file which has subscript and superscript characters in them which i got from the character map. Like so:

<value column="Back" null="false">H₂</value>

但是当我在Android的一个TextView显示它,它给了我这个哈,,

but when i display it on a textview in android it gives me this 'Hâ,,'

我怎样才能解决这一问题,并在我的应用程序正常显示呢?

how can i fix this and display it properly in my app?

推荐答案

我发现了如何

在XML文件中使用code应该是这样的:

In the XML file the code should be like this :

&LT;值列=返回空=假&GT;的H&amp; lt;副和放大器; GT; 2及LT; /分和放大​​器; GT;&LT; /值&GT;

这样的parced字符串值H&lt;副大于2&LT; /子&gt;中
然后在java code:

So that the parced string value is "H<sub>2</sub>" then in the java code :

TextView textview.setText(Html.fromHtml(YourString);

和对标用SUP,而不是分

and for superscript use "sup" instead of "sub"

这篇关于标和下标在Android应用程序的XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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