我试图在我的Android应用程序中显示数学公式我使用tiny_mce与WIRIS插件编写公式为图像下面
编辑器将公式存储在数据库中,格式如下
<p><math xmlns="http://www.w3.org/1998/Math/MathML"><mroot><mrow><mn>3</mn>
<mi>x</mi></mrow><mn>2</mn></mroot><mo>×</mo><mn>2</mn>
<mimathvariant="normal">π</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>×</mo><mn>2</mn><mi mathvariant=\"normal\">π</mi></math></p>");
但它不起作用它向我展示了没有数学公式符号的唯一数字
这里有一个GitHub库和MathView教程,它不适用于wiris编辑器MathView on github的输出
你有什么帮助或建议在Android应用程序中显示wiris输出格式吗?
当我在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>×</mo><mn>2</mn><mi mathvariant=\"normal\">π</mi></math></p>$$");
希望这会奏效。