2017-06-21 70 views
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); 

我说的一切,我从here的资产文件夹中下载的文件,但我得到的,当我运行的应用程序是$$x={-b±√{b^2-4ac}}/{2a}$$,而不是预期方程。有什么我缺少的。jqMath不显示公式

回答

0

检查您的路径,这是由于您的文件路径错误,我猜你已将mathscribe文件夹存储在资产中,然后使用此代码,如果已保存完整路径,则必须修改路径文件夹在资产中进行计算。 新路径

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

希望这将有助于....

0

在js变量的文件名必须是相同的folder.I认为资产已经下载了最新版本的文件,但复制从一些较旧的线程粘贴代码。