これは私の主な活動のAndroidのWebView、3.xの
package com.example.mathjax_issues;
import android.os.Bundle;
import android.app.Activity;
import android.graphics.Bitmap;
import android.util.Log;
import android.view.Menu;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends Activity {
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webView=(WebView)findViewById(R.id.webView1);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new MyWebViewClient());
webView.loadUrl("file:///android_asset/MathJax/test/sample-asciimath.html");
// String html="<!DOCTYPE html> <html> <head> <title>MathJax AsciiMath Test Page</title> <!-- Copyright (c) 2012-2013 The MathJax Consortium --> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /> <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" /> <script type=\"text/javascript\" src=\"file:///android_asset/MathJax/MathJax.js?config=AM_HTMLorMML-full\"></script> </head> <body> <p> When `a != 0`, there are two solutions to `ax^2 + bx + c = 0` and they are </p> <p style=\"text-align:center\"> `x = (-b +- sqrt(b^2-4ac))/(2a) .` </p> </body> </html> ";
// Log.e("html",html);
// webView.loadDataWithBaseURL("file:///android_asset/MathJax", html, "text/html","utf-8", "");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
private class MyWebViewClient extends WebViewClient
{
@Override
public void onPageFinished(WebView view, String url) {
// TODO Auto-generated method stub
super.onPageFinished(view, url);
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// TODO Auto-generated method stub
super.onPageStarted(view, url, favicon);
}
}
}
この私のサンプルasciimath.html以下
<!DOCTYPE html>
<html>
<head>
<title>MathJax AsciiMath Test Page</title>
<!-- Copyright (c) 2012-2013 The MathJax Consortium -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script type="text/javascript" src="../MathJax.js?config=AM_HTMLorMML-full"></script>
</head>
<body>
<p>
When `a != 0`, there are two solutions to `ax^2 + bx + c = 0` and they are
</p>
<p style="text-align:center">
`x = (-b +- sqrt(b^2-4ac))/(2a) .`
</p>
</body>
</html>
での画像であります私のプロジェクト
2.3.3,2.2,4.1.2,4.2.2緯度にこのコードをコンパイルしますエストバージョン
私はソース
が、私は私が3.0,3.1と4.0.3,4.0.4アンドロイドのバージョン
で同じソースをコンパイルからの正しい出力を得ますplsは私を助けて、この
友達のような間違った出力を取得...私はすることができませんこのエラーを解決する...私は...あなたたちは私に私が資産に..ローカル事前に
感謝をmathjaxを格納しています
いくつかのアイデアを与えるjavascriptのproblem.Hopeがあるかもしれないと思う
は[この記事]で説明されたあなたの問題を解決する、[1] [1]:http://stackoverflow.com/questions/17029780/display-good-looking-math-formula-in-android?answertab=active#tab-top –
すべての回答が私のために働いていません –
私は何も仕事の友人を除いてすべてを試みました.. –