数学公式格式没有出现在android mathView中

时间:2018-03-01 21:28:05

标签: java android android-studio tinymce-4 wiris

我想在我的Android应用程序中显示数学公式我使用tiny_mce和WIRIS插件将公式编写为下图 enter image description here

编辑器将公式存储在数据库中,格式如下

<p><math xmlns="http://www.w3.org/1998/Math/MathML"><mroot><mrow><mn>3</mn>
   <mi>x</mi></mrow><mn>2</mn></mroot><mo>&#215;</mo><mn>2</mn>
   <mimathvariant="normal">&#960;</mi></math></p>

我也在我的Android应用程序中使用MathView将此公式显示如下

 MathView testMathView=(MathView) findViewById(R.id.test);
    testMathView.setText("<p><math xmlns=\"http://www.w3.org/1998/Math/MathML\">" +
          "<mroot><mrow><mn>3</mn><mi>x</mi></mrow><mn>2</mn></mroot>" +
          "<mo>&#215;</mo><mn>2</mn><mi mathvariant=\"normal\">&#960;</mi></math></p>");

但它不起作用它向我展示了没有数学公式符号的唯一数字

这里有一个GitHub库和MathView教程,它不适用于wiris编辑器的输出 MathView on github

你可以提供任何帮助或建议在Android应用程序中显示wiris输出格式吗?

1 个答案:

答案 0 :(得分:2)

当我在您关联的GitHub上的文档中阅读时,您应该在auto:engine="MathJax"MathView中设置setText,如下所示:

testMathView.setText("$$<p><math xmlns=\"http://www.w3.org/1998/Math/MathML\">" +
      "<mroot><mrow><mn>3</mn><mi>x</mi></mrow><mn>2</mn></mroot>" +
      "<mo>&#215;</mo><mn>2</mn><mi mathvariant=\"normal\">&#960;</mi></math></p>$$");

希望这会奏效。