2
원격 서버에서 html 파일을로드하고 웹보기에 표시하지만 내 언어의 기본 글꼴은 약간 지저분하므로 자산 폴더에서 글꼴을로드하려고했습니다. 여기에 내 자바 코드와 HTML 파일이 있습니다.자산 폴더에서 글꼴로드
webView.getSettings().setAppCacheEnabled(false);
webView.getSettings().setAppCacheMaxSize(1);
webView.getSettings().setDomStorageEnabled(true);
webView.addJavascriptInterface(new WebAppInterface(this), "Android");
webView.setWebViewClient(new MyWebViewClient());
isShowing=true;
dialog.show();
String address="http://server/test.html";
Log.d("checking", address);
webView.loadUrl(address);
html 코드 :
11-21 10:50:55.439: E/Web Console(9572): Not allowed to load local resource: file:///android_asset/fonts/BNAZANIN.TTF at :0
이에 대한 해결책은 무엇인가 :
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> Title Here </title>
<style type="text/css">
@font-face {
font-family:nazanin;
src:url('file:///android_asset/fonts/BNAZANIN.TTF');
}
body {
font-family: nazanin;
font-size: medium;
text-align: justify;
}
</style>
</head>
<body>
<p>this is for test</p>
</body>
</html>
문제가 I이 오류가있어 로딩 후인가?
이 질문은 중복 된 것으로 잘못 표시되어 있습니다. OP는 외부 URL의 웹보기에서 글꼴로 액세스하려고했으나 로컬 .html 파일이있는 웹보기를 리디렉션 된대로 읽지 않으려 고합니다. 커뮤니티로 이동하는 방법 .. . – desgraci