How to set a custom font of Webview in Android 4.2.2?

399 views Asked by At

I want to set a custom font in webview android 4.2.2. I did the code to set custom font but that's not working on 4.2.2 and the same code working on an other android version. Here I used below code

data="ઘૂંટણની સખત ત્વચા અને કાળી પડી ગયેલી કોણી પર લીંબુમાં ખાંડ મિક્સ કરી આ મિશ્રણ બરાબર ઘસો";

String head = "@font-face {font-family: 'MyFont';src: url('file:///android_asset/NotoSansGujaratiUI-Regular.ttf')}body {font-family: 'MyFont';}";

String htmlData = ""
            + head + "" + data + "";

webView.loadDataWithBaseURL("", htmlData, "text/html", "charset=utf-8", "");

I also post screenshots of running device

It shows working device in green circle and not working device in red circle means 4.2.2

pls give me solution regarding this

0

There are 0 answers