简体   繁体   English

如何为Android应用增加jqMath方程的字体大小

[英]How to increase font size of jqMath equation for Android app

So here's my code: 所以这是我的代码:

webView = (WebView) findViewById(R.id.layout_webview);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
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>";
webView.loadDataWithBaseURL("", js, "text/html", "UTF-8", "");

Even though I set the fontsize to 100 the equation doesn't change in size at all no matter what number I set in the font size. 即使我将fontsize设置为100,无论我将字体大小设置为多少,等式的大小都不会改变。 Is there a way to increase the font size of the equation? 有没有办法增加等式的字体大小?

It is not clear where and when you set the font size to 100 (as it is not apparent in the code you posted). 目前尚不清楚在何时何地将字体大小设置为100(因为在发布的代码中看不出来)。

According to this other answer you should set the font size after loading jqmath-xycss in order to override the values it contains. 根据另一个答案,您应该加载jqmath-xycss 之后设置字体大小以覆盖其包含的值。

Try setting it in the JavaScript after the code you posted. 尝试在发布代码后在JavaScript中进行设置。 Something like document.body.style.fontSize = "100pt"; 类似于document.body.style.fontSize = "100pt"; after your document.write for example. 例如,在document.write之后。

 var s = '$$x={-b±√{b^2-4ac}}/{2a}$$'; M.parseMath(s); document.write(s); document.body.style.fontSize = "40pt"; 
 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="http://mathscribe.com/mathscribe/jqmath-0.4.0.css" /> <script type="text/javascript" src="http://mathscribe.com/mathscribe/jqmath-etc-0.4.0.min.js"></script> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM