Java 如何将字符串数组中的文本格式化为android的数学格式?

Java 如何将字符串数组中的文本格式化为android的数学格式?,java,android,arrays,eclipse,math,Java,Android,Arrays,Eclipse,Math,我有一个帮助人们学习微积分的应用程序,我想让它看起来像实际的数学代码,而不是像x^2+(x^1/2)-4的方程。项目中的代码如下所示。我已经研究过这个话题,我没有看到一个明确的解决方案。谢谢 public class Limits extends Activity implements OnClickListener { private static final int SWIPE_MIN_DISTANCE = 120; private static final int SWIPE_MA

我有一个帮助人们学习微积分的应用程序,我想让它看起来像实际的数学代码,而不是像x^2+(x^1/2)-4的方程。项目中的代码如下所示。我已经研究过这个话题,我没有看到一个明确的解决方案。谢谢

public class Limits extends Activity implements
    OnClickListener {
private static final int SWIPE_MIN_DISTANCE = 120;
private static final int SWIPE_MAX_OFF_PATH = 250;
private static final int SWIPE_THRESHOLD_VELOCITY = 200;
private GestureDetector gestureDetector;

View.OnTouchListener gestureListener;

String facts[] = {

//limits
"Find the limit as x approaches 0 of x^3+4x^2+6x+7",
"Find the limit as x approaches infinity of x/x^2",
"Find the limit as x approaches 3 of (x+3)^2/(x+6)",
"Find the limit as x approaches infinity of x^3/x",
"Find the limit as x approaches 3 of (x^2-6x+9)/(x-3)",
"Find the limit as x approaches 7 of 49x^2/7x",
"Find the limit as x approaches infinity of (2x^2-5x+3)/(x^2-7x+7)",
"Find the limit as x approaches 2 of (x − 2/x^2 − 19x + 34)",
"Find the limit as x approaches 6 of ((|x-6|)/(x-6))",
})

尝试使用HTML:

Html.fromHtml("X<sup>2</sup>")
Html.fromHtml(“X2”)

什么是“实际数学代码”?“x^2+(x^1/2)-4”在我看来就像一个数学方程。它唯一没有的就是指数幂的上标。对吧,你怎么启用上标?我指的是像这样的数学代码。看看你提到的例子,假设所使用的注释是你想要使用的所有东西,那么唯一不容易做的就是除数和根注释。我能想到的唯一方法是扩展TextView,重写onDraw()并手工绘制文本。看看Spannables,如果你这样做的话,我建议你考虑把它建成一个图书馆并出版它。我相信你会得到用户…所以已经有一段时间了,html确实可以做到这一点,但是你如何让部门工作呢。