本文介绍了如何在Android安装JqMath?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的Andr​​oid应用程序,显示一些数学公式,但我不确定你如何使用JqMath显示这些方程。有人能告诉我一步一步怎么做才能在Android应用程序中显示一些简单的公式?我曾尝试以下内容:

I am trying to display some math equations in my Android application, but I am unsure how you use JqMath to display these equations. Could someone tell me step by step what to do to get some simple equations displayed on the Android Application? I have tried the following:

 mEquationWebView = (WebView)v.findViewById(R.id.equation_webView);
    WebSettings mWebSettings = mEquationWebView.getSettings();
    mWebSettings.setJavaScriptEnabled(true);
    String path="file:///android_asset/";
    String js = "<html><head>"
            + "<link rel='stylesheet' href='file:///android_asset/mathscribe/jqmath-0.4.0.css'>"
            + "<script src = 'file:///android_asset/mathscribe/jquery-1.4.3.min.js'></script>"
            + "<script src = 'file:///android_asset/mathscribe/jqmath-etc-0.4.2.min.js'></script>"
            + "</head><body>"
            + "<script>var s =   '$$x={-b±√{b^2-4ac}}/{2a}$$';M.parseMath(s);document.write(s);</script> </body>";
    mEquationWebView.loadDataWithBaseURL("",js,"text/html", "UTF-8", "");

和得到以下错误:
无法打开资源网址:文件:///android_asset/mathscribe/jqmath-0.4.0.css
无法打开资源网址:文件:///android_asset/mathscribe/jqmath-etc-0.4.2.min.js
无法打开资源网址:文件:///android_asset/mathscribe/jquery-1.4.3.min.js

And get the following errors:Unable to open asset URL: file:///android_asset/mathscribe/jqmath-0.4.0.cssUnable to open asset URL: file:///android_asset/mathscribe/jqmath-etc-0.4.2.min.jsUnable to open asset URL: file:///android_asset/mathscribe/jquery-1.4.3.min.js

我想问题可能是,我需要一些jqMath文件下载到Android资产的文件夹,但我不知道在哪里可以找到这些文件。

I think the problem might be that I need to download some jqMath files to my Android assets folder, but I'm not sure where to find these files.

推荐答案

如果你没有这些文件还没有,去的并点击下载jqMath链接在页面的中间,以jqMath下载到您的计算机。然后,您需要把正确的文件在您的资产文件夹中。

If you don't have the files yet, go to http://mathscribe.com/author/jqmath.html and click the "download jqMath" link in the middle of that page, to download jqMath to your computer. You'll then need to put the correct files in your assets folder.

另外,M.parseMath()应仅被应用到在DOM中的节点,而不是一个字符串变量。你的 M.parseMath(S); 称这里是一个无操作(什么都不做)

Also, M.parseMath() should only be applied to a node in the DOM, not a string variable. Your M.parseMath(s); call here is a no-op (does nothing).

您可以取代你的整个行:

You could replace your entire line:

    + "<script>var s =   '$$x={-b±√{b^2-4ac}}/{2a}$$';M.parseMath(s);document.write(s);</script> </body>";

只有

    + "$$x={-b±√{b^2-4ac}}/{2a}$$</body></html>";

这篇关于如何在Android安装JqMath?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 21:00