安卓:我想用我的自定义字体,WebViewb [英] android : i want use my custom font with WebViewb

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

问题描述

我想用我的自定义字体,WebViewb
在web视图,但仍然没有字体
我的html文件加载 我的字体有统一code字
我的工作在Android 2.2

  mWebView.loadUrl(文件:///android_asset/P_007.html);
 

我的CSS:

 <风格类型=文本/ CSS>
 @字体面{
    字体家庭:AQF_P007_HA;
    SRC:网址(AQF_P007_HA.TTF);
}
体 {
    字体家庭:AQF_P007_HA;
    字体风格:正常;
    字体重量:正常;
    颜色:黑色;
    字体大小:介质;
    MSO的字体,字符集:0
}
< / STYLE>
 

解决方案

一个解决方案是在这里的文件:的如何使用自定义字体,web视图

这是类似于您尝试在HTML文件中使用? 由于相对于你的资产URL文件夹在这种情况下?

  @字体面{
   字体家庭:AQF_P001_HA;
   SRC:网址(AQF_P001_HA.TTF');
}

身体{字体家庭:AQF_P001_HA';}
 

i want use my custom font with WebViewb
my html file loaded in webView but still without font
my font has Unicode characters
i work on android 2.2

mWebView.loadUrl("file:///android_asset/P_007.html");       

my css:

<STYLE type="text/css">
 @font-face {
    font-family: AQF_P007_HA;
    src: url("AQF_P007_HA.TTF");    
}
body {
    font-family: AQF_P007_HA;    
    font-style:normal;
    font-weight: normal;
    color: black;    
    font-size: medium;
    mso-font-charset: 0
}
</STYLE>

解决方案

A solution is document here: How to use custom font with Webview

is this similar to what you tried to use in your html file? With the url relative to your assets folder in this case?

@font-face {
   font-family: 'AQF_P001_HA';
   src: url('AQF_P001_HA.TTF');
}

body {font-family: 'AQF_P001_HA';}

这篇关于安卓:我想用我的自定义字体,WebViewb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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