WebView 加何加载本地资源里的ttf,svg,woff等相关的字体文件?

String URL =
        "content://com.myapption.dataability/rawfile/index.html";
     
webView.getWebConfig().setDataAbilityPermit(true);
        webView.getWebConfig().setWebStoragePermit(true);
        webView.getWebConfig().setLocationPermit(true);
        webView.getWebConfig().setLoadsImagesPermit(true);
//        webView.getWebConfig().setSecurityMode(WebConfig.SECURITY_SELF_ADAPTIVE);
        webView.getWebConfig().setSecurityMode(WebConfig.SECURITY_ALLOW);
        webView.getWebConfig().setJavaScriptPermit(true);
        webView.load(URL);

rawfile目录里css文件设置的fonts文件无法正常显示出来,这问题如何解决?

鸿蒙
WebView
字体文件
2022-01-18 14:35:33
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
左四

可以参考如下链接。

https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ui-java-component-webview-0000001092715158#section1520395312432

分享
微博
QQ
微信
回复
2022-01-18 15:39:21


相关问题
HarmonyOS Webview load本地资源问题
274浏览 • 1回复 待解决
HarmonyOS webview加载本地html问题
1455浏览 • 1回复 待解决
动态加载网络字体文件
1186浏览 • 1回复 待解决
HarmonyOS Web本地资源跨域加载异常
303浏览 • 1回复 待解决
如何使用Web组件加载本地html文件
1479浏览 • 1回复 待解决