How to call apk font use CSS in android?

Tags: android,css,android-webview

Problem :

I set the font for webview. Because the font file is too large, it will Impact loading time seriously when putting the font file in server.

So I decide to pack the font file into apk. But I do not know how to call it in css?

Could anyone give me some advice? Thanks.

Solution :

You can set the path in css as like this way

@font-face {
   font-family: 'android_myface';
   src: url('file:///android_asset/fonts/myfont.ttf'); 

and use it

    font-family: 'android_myface', serif;

Put your myfont.ttf file in your assests folder

    CSS Howto..

    How do I resize the border of the body as the window resizes in CSS

    How to print outlines and background colors from css, when using JQuery printElement, and IE8?

    How to make footer not overlap and positioned properly?

    How do i remove li element margin

    How to make a hidden face appear from the top using -webkit-transform: rotateX();

    How to create a ribbon shape in CSS

    How to use a defined property value as another property in pure CSS?

    How know CSS version - ASP.NET - VS Community 2013

    Bootstrap, css How to change background

    How to change the font-size of the part of textarea text in HTML,CSS?

    How to select Bootstrap's collapsed menu button with CSS

    How to create responsive square

    How do I override inline CSS with Class CSS? [duplicate]

    How to remove the default active tab color when another tab is active using jquery

    How can I avoid div overflowing my container without using overflow:hidden?

    How to hide a nested table?

    How to overwrite an !important CSS property in jQuery

    CSS: How to get thumbnails into a horizontal line?

    how to scale an image disproportionally via css?

    How to: Reduce font-size if a line breaks

    How can I expand this picture to cover the width of my page?

    how to make html table first row 'absolute'

    How to apply different width stored in PHP to 3 identical DIVs (using same CSS)

    Using yepnope, how can I know if a css resource was loaded successfully?

    Flexbox in Chrome--How to limit size of nested elements? [duplicate]

    How to align an absolute DIV of unknown height outside a “relative” parent by CSS?

    How to load multiple images quickly (without Css Sprites)

    How could i center unordered lists in a footer?

    IE8 and lower showing background white

    How to get access to file css in JSF 2.0