Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Is it possible to overlay text on text?

I want to create special characters for math, for an android application.
And I wonder if it's is possible to overlay one character on top of another, or if there is some fine control on how text is rendered (and how do you go about doing that).

like image 331
ilomambo Avatar asked Jan 20 '26 11:01

ilomambo


2 Answers

If you need a general method to display math equations, have a look at jqMath. I think you can render it using a WebView.

Many math symbols have Unicode code points. Specifically, the Unicode code point for the symbol of a '+' inside a circle is U+2295. They can be rendered directly if the font supports it. For a list of some math symbols with corresponding Unicode code points check this Wikipedia article.

Also have a look at this question for resources using MathML in Java.

like image 120
Dheeraj Vepakomma Avatar answered Jan 23 '26 00:01

Dheeraj Vepakomma


I would extend the View class and then use the drawText method of the Canvas object you receive in the onDraw method. It sounds like you need fine control over coordinates of where text is being painted and extending View would give you just that. Take a look at Canvas.drawText and you can use the x and y coordinates to overlay text as you require.

like image 36
Ameen Avatar answered Jan 23 '26 01:01

Ameen