I want to change the default font for webview to my own font. I am using webview in my android app.
I tried to get a custom font instance by placing my own font in assets. But still failed to set the default font for the web browser.
This is what I tried:
WebView myWebView = (WebView) findViewById(R.id.myWebView);
myWebView.setBackgroundColor(0x00000000);
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.loadUrl("file:///android_asset/Hindi/MyHTMLinHindi.html");
and in the css file I tried:
@font-face {
font-family:Mangal;
src: url("file:///android_asset/Fonts/mangal.ttf")
}
body {
font-family:Mangal;
}
Please suggest me any way ... Thanx in advance ..
source
share