1、要求:显示诸如:之类的数学题。
2、解决方法:
a、使用控件:webview
b、控件设置:webview.getSettings().setJavaScriptEnabled(true);
c、使用mathtype这个软件,生成工式代码,软件的应用可以度娘。
注:preferences-cut and copy perferences 设置为:
设置完后,选中工式,复制,即可得到以上工式的代码对应为 \[\sqrt {{a^2} + {b^2}} \]
d、组装 html,把上面得到的工式代码放到html中,如下
<html>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default"></script>
<body>
<p> 已知工式如下: \[\sqrt {{a^2} + {b^2}} \]
求解。</p>
</body>
</html>
e、生成结果:用webview.loadDataWithBaseURL(null, str, "text/html", "UTF-8",null) 加载以上html,即可显示出工式。