Android:在WebView使用CSS问题的自定义字体 [英] Android: custom font in WebView using CSS issue

查看:286
本文介绍了Android:在WebView使用CSS问题的自定义字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用网络视图开发应用程序。我创建了一些html文件与图像和css(在html文件内)。当我把文件放入assests文件夹自定义字体不加载。没有任何变化,我把它放在服务器上,通过移动浏览器访问或访问它通过应用程序引用在线网址(即 http ://hotwordpresstips.com/japs/Index.html ),它会正常显示。我在这里缺什么?请在下面找到我的HTML代码。如果你想我也会把java代码。

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>


推荐答案

。我们需要将字体文件放在assets文件夹:)它不会在Android 2.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.

这篇关于Android:在WebView使用CSS问题的自定义字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆