java - Change font html in webview Android -


i'm displaying html text coming epub file inside android application through webview. i'd set font used no matter font used in epub file. activity code:

public class contentviewactivity extends activity {     webview webview;     @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.content);          webview = (webview) findviewbyid(r.id.webview);         webview.getsettings().setjavascriptenabled(true);          string displaystring = getintent().getextras().getstring("display");         if(displaystring != null)             webview.loaddata(displaystring, "text/html", "utf-8");         }     } } 

i've tried using websettings or base url suggested in question using:

if(displaystring != null) {         webview.loadurl("file:///android_asset/html/my_page.html");         webview.loaddatawithbaseurl("file:///android_asset/html/my_page.html", displaystring, "text/html", "utf-8", null);     } 

with

<html>  <head>  <style type="text/css">  @font-face {      font-family: myfont;      src: url("file:///android_asset/fonts/bookerly.ttf")  }  body {      font-family: myfont;      font-size: medium;      text-align: justify;  }  </style>  </head>  <body>  text can go here  </body>  </html>

however when run it, seems ignoring base url , displaying original html. there way fix or way proceed?

thanks in advance,

ps: of course cannot change css of epub file.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -