mathml的mathjax就像所有具有api <19的手机中的魅力一样,但我有一个平板电脑,我在webview中重新加载数据有问题,即它第一次加载mathml但是当我重新加载另一个mathml代码时相同的webview内容没有变化......代码是
wq.getSettings().setJavaScriptEnabled(true);
wq.getSettings().setBuiltInZoomControls(true);
wq.getSettings().setLoadWithOverviewMode(true);
wq.loadDataWithBaseURL("http://bar", "<script type='text/x-mathjax-config'>"
+"MathJax.Hub.Config({ "
+"showMathMenu: false, "
+"jax: ['input/MathML','output/HTML-CSS'], " // output/SVG
+"extensions: ['mml2jax.js'], "
+"TeX: { extensions: ['noErrors.js','noUndefined.js'] }, "
//+"'SVG' : { blacker: 30, "
// +"styles: { path: { 'shape-rendering': 'crispEdges' } } } "
+"});</script>"
+"<script type='text/javascript' "
+"src='file:///android_asset/MathJax/MathJax.js'"
+"></script><span id='text'> </span> <span id='math'></span>", "text/html", "utf-8", "");
if (android.os.Build.VERSION.SDK_INT < 19)
{
wq.loadUrl("javascript:document.getElementById('math').innerHTML='"
+ "<math xmlns=\"http://www.w3.org/1998/Math/MathML\">"
+ "<mstyle displaystyle=\"true\">"
+ doubleEscapeTeX(questn)
+ "</mstyle></math>';");
wq.loadUrl("javascript:MathJax.Hub.Queue(['Typeset',MathJax.Hub]);");
}
else
{
wq.loadUrl("javascript:document.getElementById('math').innerHTML='"
+ "<math xmlns=\"http://www.w3.org/1998/Math/MathML\">"
+ "<mstyle displaystyle=\"true\">"
+ doubleEscapeTeX(questn)
+ "</mstyle></math>';"); wq.evaluateJavascript("javascript:MathJax.Hub.Queue(['Typeset',MathJax.Hub]);",null);
}
请帮忙。 Thanx提前
答案 0 :(得分:1)
我得到了Sollution ......
void loadwebview()
{
wq.getSettings().setJavaScriptEnabled(true);
wq.getSettings().setBuiltInZoomControls(true);
wq.getSettings().setLoadWithOverviewMode(true);
wq.loadDataWithBaseURL("**http://bar/**", "<script type='text/x-mathjax-config'>"
+"MathJax.Hub.Config({ "
+"showMathMenu: false, "
+"jax: ['input/MathML','output/HTML-CSS'], " // output/SVG
+"extensions: ['mml2jax.js'], "
+"TeX: { extensions: ['noErrors.js','noUndefined.js'] }, "
//+"'SVG' : { blacker: 30, "
// +"styles: { path: { 'shape-rendering': 'crispEdges' } } } "
+"});</script>"
+"<script type='text/javascript' "
+"src='file:///android_asset/MathJax/MathJax.js'"
+"></script><span id='text'> </span> <span id='math'></span>", "text/html", "utf-8", "");
}
void insertdata(String questn)
{
if (android.os.Build.VERSION.SDK_INT < 19)
{
wq.loadUrl("javascript:document.getElementById('math').innerHTML='"
+ "<math xmlns=\"http://www.w3.org/1998/Math/MathML\">"
+ "<mstyle displaystyle=\"true\">"
+ doubleEscapeTeX(questn)
+ "</mstyle></math>';");
wq.loadUrl("javascript:MathJax.Hub.Queue(['Typeset',MathJax.Hub]);");
}
else
{
wq.evaluateJavascript("javascript:document.getElementById('math').innerHTML='<font color=\"#000000\">`"+doubleEscapeTeX(questn)+"`</font>';",null);
wq.loadUrl("javascript:MathJax.Hub.Queue(['Typeset',MathJax.Hub]);");
}
}