gpt4 book ai didi

android - 网页 View 中的字体没有改变

转载 作者:行者123 更新时间:2023-11-29 00:46:50 25 4
gpt4 key购买 nike

Typeface hnr = Typeface.createFromAsset(this.getAssets(), "HelveticaNeueLTStd-Md.otf");

html ="<html><head><title></title> "
+ "<style type=\"text/css\"> "
+ "body {font-family:"
+ hnr
+ "; } "
+ "</style> "
+ "</head><body ><TABLE>"
+ "<TR>" + "<TD ALIGN=\"left\" > "
+ "<p><font face='"+hnr+"'>"+ data
+ "</font></p></TD></TR>" + "<TR>" + "</TABLE></body>
</html>";
webview.loadDataWithBaseURL("", html, "text/html", "utf-8", "");

这是我的代码,但显示时字体没有改变。

最佳答案

尝试使用 CSS3 字体规则:

html = "<!DOCTYPE HTML>\n<html>\n<head>\n<style>\n"
+ "@font-face { font-family: yourFont; src: url('HelveticaNeueLTStd-Md.otf'); }"
+ "body { font-family: yourFont; }"
+ "</style></head><body>" + data + "</body></html>";

关于android - 网页 View 中的字体没有改变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5908680/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com