How to show special characters in Android?

2019-03-29 19:47发布

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

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

Formulas

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..

2条回答
劳资没心,怎么记你
2楼-- · 2019-03-29 20:02

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.

查看更多
我想做一个坏孩纸
3楼-- · 2019-03-29 20:20

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.

查看更多
登录 后发表回答