2017-09-18 4 views
2

Hy,webView ignorant css lors du chargement du contenu de EPUB3

Je travaille sur un lecteur, et nous travaillions sur epub2, et je travaille sur l'effet de la pagination en utilisant le fichier Css. J'ai récemment reçu un fichier ePub 3 et il ne respecte pas les règles css que j'ai fournies, bien qu'il fonctionne correctement lorsqu'il est essayé sur Play Livres android app.

Veuillez noter que j'ai manipulé plusieurs fonctions liées à l'affichage Web tels que:

testWV.getSettings().setUseWideViewPort(true); 
testWV.getSettings().setLoadWithOverviewMode(true); 

et c'est le css d'appel utilisé qui, comme mentionné précédemment fonctionne parfaitement sur les fichiers epub2

html { 
    height:heightplaceholderpx; //set dynamically depending on phone screen size 

    width:100%; 
    } 

body { 
    margin:0px; 
    padding:0px; 
    width:100%; 

    pointer-events: none; 
    } 


#viewer { 
    width:widthplaceholderpx; 
    height:heightplaceholderpx; 
} 

#book { 
    width:widthplaceholderpx; 
    height:heightplaceholderpx; 

    margin-left:50px; 
    margin-right:50px; 
    margin-top:10px; 

    -webkit-column-count:auto; 
    -webkit-column-width:widthplaceholderpx; 
    -webkit-column-gap:100px; 
    text-align:justify; 
} 

.h { 
    margin-top:60px; 
    margin-left:100px; 
    margin-right:100px; 
} 


img { 
    max-width: 100%; 
    height:auto; 
} 

Veuillez notez que, voici comment j'intègre le fichier css:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <link rel="stylesheet" href="columnPaging.css" type="text/css" media="screen"/> 
    headplaceholder //the header extracted from the xhtml file of the book 
</head> 
<body> 
    <div id="viewer"> 
    <div id="book"> 
     bodyplaceholder //the body extracted from the xhtml file of the book 
    </div> 
    </div> 
</body> 
</html> 

Répondre

2

Comme vous peut vous voir utiliser ce var widthplaceholderpx dans son css. Normalement, il devrait être surchargé dans le code Java. Mais quand le bodyplaceholder a été ajouté au corps dans le code HTML, j'ai dû redéfinir le widthplaceholderpx à nouveau. Donc le css saurait quelle était la hauteur réelle.