![](/img/trans.png)
[英]Unable to display text from stored procedure to textview - Android SQL Server
[英]Unable to display subscript text in textView
我剛接觸Android,正在嘗試在customListView包含的textView中顯示一些化學式。 我要從xml解析中獲取所有數據,然后希望顯示公式,例如C₉H₈O₄。 但是我只能看到1-4位數字。
我以這種方式從“正常”轉換為“下標”
str = str.replaceAll("0", "\u2080");
str = str.replaceAll("1", "\u2081");
str = str.replaceAll("2", "\u2082");
str = str.replaceAll("3", "\u2083");
str = str.replaceAll("4", "\u2084");
str = str.replaceAll("5", "\u2085");
str = str.replaceAll("6", "\u2086");
str = str.replaceAll("7", "\u2087");
str = str.replaceAll("8", "\u2088");
str = str.replaceAll("9", "\u2089");
str包含從xml文件獲取的公式。
奇怪的行為是我可以在Logcat中看到應有的公式。
我也嘗試使用海關字體,但一無所獲。
這是兩個結果:第一個是普通字體,第二個是自定義字體
https://www.dropbox.com/s/jyk64p700up14db/cella.jpg https://www.dropbox.com/s/ab9h1b45j2hrods/Schermata%2003-2456370%20alle%2022.05.45.png
在網絡上,我可以使用類似以下內容的解決方案來閱讀
setText(Html.fromHtml(“ X <sub>2</sub>
”));
但我真的不知道該如何使用它。
有什么建議嗎?
嘗試使用Html.fromHtml("X<sub>2</sub>")
解決該問題並不容易,您需要一個可以幫助您實現該目標的庫
(JEuclid是完整的MathML渲染解決方案,包括:) http://jeuclid.sourceforge.net/
查看示例,您將找到解決問題的方法
使用TeX渲染數學表達式的其他替代方法:
http://jmathtex.sourceforge.net/
http://sourceforge.net/projects/snuggletex/
http://forge.scilab.org/index.php/p/jlatexmath/
最后,我解決了這個問題:這是一個字體問題。 我只是用Calibri而已!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.