3
Android 앱에서 맞춤 글꼴을 사용하고 싶습니다. TextView
의 사용자 정의 글꼴이 제대로 작동하지만 WebView
에 맞춤 (유니 코드) 글꼴을 추가하는 방법을 찾지 못했습니다. 가능한 모든 방법을 시도했지만 실패했는지, 내가 놓친 코드인지 살펴 보았습니다. 고맙습니다.!Android 앱에 WebView에서 사용자 정의 (유니 코드) 글꼴 사용
애셋 폴더에 맞춤 글꼴 모음이있는 CSS 파일을 만들고 LoadDataWithBaseURL
이라고했지만 작동하지 않습니다.
htmlTextView = (WebView) findViewById(R.id.htmlTextView);
String text = "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />";
htmlTextView.loadDataWithBaseURL("file:///android_asset/", text, "text/html", "UTF-8", null);
htmlTextView.getSettings().setJavaScriptEnabled(true);
htmlTextView.setBackgroundColor(Color.TRANSPARENT);
htmlTextView.getSettings().setDefaultFontSize(
WebHelper.getWebViewFontSize(this));
CSS 파일 :
@font-face {
font-family: 'iskoola pota';
src: url('fonts/iskpota.ttf') format('truetype');
}
나는 html 파일을 사용하고 싶지 않다. 내 워드 프레스 기반 안드로이드 앱의 게시물에 맞춤 (유니 코드) 글꼴을 사용하고 싶다. – SNoV