2017-06-21 72 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認爲資產已經下載了最新版本的文件,但複製從一些較舊的線程粘貼代碼。