How to show special characters in Android?

戏子无情 提交于 2019-12-09 13:13:35

问题


I am developing a native app which consists of some mathematical formulas.

Formulas will be like.........

I want to display such formulas in my application, but i don't how to use these special characters in Android. I want to display each formula individually in a list view...... If i am copying formula & if i am setting text to text view means it is showing like

   txtv.setText("\\cos^2\\theta + \\sin^2\\theta = 1\\! ");

and getting output in the same pattern. So, can anyone help me how to use these mathematical special characters in Android..


回答1:


Sorry, there are not a lot of different solutions.. There are no 'magical answer", here are some different ways to achieve what you want.

1) Using a webview with some Javascript

2) using a server to produce a picture of the formula.

3) Using a 9.png file embededd in your app with the square root symbol and display it as textview background

4) Drawing a canvas with all your text and symbols

5) using Hexadecimal code: http://htmlhelp.com/reference/html40/entities/symbols.html

http://tlt.its.psu.edu/suggestions/international/bylanguage/mathchart.html

6) Maybe other ideas, but definitely no way to achieve a 300 formula listview in a easiest way.




回答2:


This one seem quite good and works in Android without any issue: http://mathscribe.com/author/jqmath.html

Edit: You can run this inside a WebView, you don't need any webapp.



来源:https://stackoverflow.com/questions/11698960/how-to-show-special-characters-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!