I have some data which was formatted using MathJax
on WebApplication
. Now, I want to display those Data in Android App and that is in TextView
only.
I have already downloaded MathJax
from Leathrum's WordPress
I found some examples but all are using WebView
. But I want it using TextView
. How to get this ???
I am also using ImageGetter
with that TextView
and it is working fine. Now, just want to do something for MathJax
.
Why only TextView
???
My data contains simple text, html text, images, and math functions... I was using webview but it is showing extra space at bottom and also have using with Webview because I am using Custom ListView with WebView

- 207
- 1
- 2
- 13
-
Please clarify the steps that you have taken? – hoomi Aug 23 '14 at 10:22
-
@hoomi, I don't know how to set script and its path with `TextView`. – CSAT Aug 23 '14 at 10:44
-
From a quick search on SO it looks like TextView is not designed for this kind of thing. As per [this SO answer](http://stackoverflow.com/questions/12718519/formatting-textview-text-using-values-strings-xml-html-and-css). JavaScript also does not seem supported. – Peter Krautzberger Aug 24 '14 at 16:10
2 Answers
But I want it using TextView. How to get this ?
You don't. TextView
is not designed for this. Your choices are:
Stick with
WebView
Figure out how to render your mathematical expressions to images, then either use an
ImageView
,ImageSpan
, etc.Write your own widget that draws the mathematical expression to a
Canvas

- 986,068
- 189
- 2,389
- 2,491
MathJax is a cross-browser JavaScript library that displays mathematical notation in web browsers, using MathML, LaTeX and ASCIIMathML markup.
Source: MathJax in Wiki
The very first line has an answer for you. It's a cross-browser javascript library. you can not use it for textviews. Doesn't it make sense ?
Update:
Solution 1: You could write a mapper which will have mapping of each Math symbols to its html code and use it to showcase on your TextView based on need.
Solution 2: There is a nice open source: MathView Which is using MathJax internally that you can use.

- 8,325
- 4
- 54
- 73
-
Did you try text view.set text( HTML.fromHtml(your server response)); ? But I am not sure if it'll work. – TheLittleNaruto Aug 26 '14 at 12:00
-
Nope, My data contains some complicated html tags so `HTML.fromHtml` does not support it. `Spanned` with `ImageGetter` solved my that issue. Now, just `MathJax` is remaining. – CSAT Aug 27 '14 at 03:52
-
Did you happen to find the solution. Even I have similar problem as you ,I want to render math expression on Textview. Can you tell me if you have achieved anything in that terms. – Veena Dec 12 '19 at 06:44
-
@veena No It won't work with TextView, However you can use WebViews to make use of MathJax. – TheLittleNaruto Dec 12 '19 at 06:48
-