Use custom font in html/css

First declare your font in your css file:
@font-face {
font-family: a_cool_font_name;
src: url(‘path/to/cool/font.ttf’);
}

Then add it to your elements
p.custom_font{
font-family: a_cool_font_name; /* no .ttf */
}

ready :)

Share

WebView: Change background and font color

In order to change a WebView’s background color there is a standard way:

mWebView.setBackgroundColor(Color.Black);

In order to change a WebView’s text font color there is no standard way:
Either you change the font through the html code, or you do this:

htmlData="<font color='black'>" + htmlData + "</font>";
mWebView.loadDataWithBaseURL(null, htmlData, "text/html", "UTF-8", null);
Share