Reputation: 51
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", "");
this is my code but the font is not change when display.
Upvotes: 2
Views: 2425
Reputation: 54705
Try using CSS3 font-face rule:
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>";
Upvotes: 2
Reputation: 9023
try like this "p>font size=\"-1\" >YOUR TEXT IS HERE + "a href=\"#Offline\">View more.. /a>/p>/p/LI>/font>" and try loadData wv.loadData(yourHtmlString, "text/html", "utf-8"); and if you want to set font for page then try this wv.getSettings().setDefaultFontSize(9); here wv is my webview
Upvotes: 0