Android: custom font in WebView using CSS issue

自古美人都是妖i 提交于 2019-12-24 15:02:01

问题


I'm currently developing an app using web view. I created some html files along with images and css (inside html file). When I put the files into assests folder the custom font is not loading. Without anychange i put it on server and accessed via mobile browser or accessed it via the app refering the online url (i.e. http://hotwordpresstips.com/japs/Index.html) and it shows properly. what am I missing here?? please find my HTML code below. If you want I'll put the java code too.

<html>
<head>
<style type="text/css">
@font-face {
 font-family: MyCustomFont;
 src: url("Bamini.eot") /* EOT file for IE */
}
@font-face {
 font-family: MyCustomFont;
 src: url("Bamini.ttf") /* TTF file for CSS3 browsers */
}

body {
 font-family: MyCustomFont, Verdana, Arial, sans-serif;
 font-size: medium;
 color: black
}
</style>
</head>
<body>
<div style="border:2px solid black;">
<img src="header.jpg" width=100%>
<h1>,yq;ifiaj; jhf;fpa [g;ghdpau;fs;</h1>
<UL>
<LI><a href="intro.html">cyf Aj;jk; mwpKfk;</a></LI>
<LI><a href="america.html">mnkupf;fhtpd; tUif</a></LI>
<LI><a href="pilot.html">tPuk; epiwe;j tpkhd Xl;b</a></LI>
<LI><a href="colombo.html">nfhOk;G> jpUkiyj; jhf;Fjy;</a></LI>
<LI><a href="end.html">KbTiu</a></LI>
<LI><a href="image.html">gbkq;fs;</a></LI>
<img src="footer_main.jpg" width=100%">
</UL>
</div>
</body>
</html>

回答1:


I figured it out. we need to put the font file in the assets folder :) and it won't work on android 2.1 as that is a known issue.



来源:https://stackoverflow.com/questions/4994118/android-custom-font-in-webview-using-css-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!