0
WebView webView = (WebView)findViewById(R.id.display);
    WebSettings webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    String path="file:///android_asset/";
    String js = "<html><head>"
            + "<link rel='stylesheet' href='"+path+"jqmath-0.4.3.css'>"
            + "<script src='"+path+"jquery-1.4.3.min.js'></script>"
            + "<script src='"+path+"jqmath-etc-0.4.5.min.js'></script>"
            + "</head><body>"
            + "$$x={-b±√{b^2-4ac}}/{2a}$$</body></html>";
    webView.loadDataWithBaseURL( "file:///android_asset/" ,js,  "text/html",  "UTF-8", null);

我将我从这里下载的所有文件添加到 assets 文件夹中,但是当我运行应用程序时得到的只是$$x={-b±√{b^2-4ac}}/{2a}$$预期的等式。有什么我想念的吗。

4

2 回答 2

0

检查您的路径,这是由于文件路径错误,我猜您已将 mathscribe 文件夹存储在 assets 中,然后您正在使用此代码,如果您已将完整的文件夹 mathscribe 保存在 assets 中,则必须修改路径. 新路径

String path = "file:///android_asset/mathscribe/"

希望这会有所帮助....

于 2017-07-12T19:18:30.080 回答
0

js 变量中的文件名必须与 assets 文件夹中的文件名相同。我认为您已经下载了最新版本的文件,但从一些较旧的线程中复制粘贴了代码。

于 2018-01-07T13:20:27.250 回答