2017-09-18 51 views
2

海蘭,webView的加載時EPUB3內容

我工作的讀者,我們用對epub2工作,我使用.css文件上分頁影響工作忽略CSS。 我最近收到了一個ePub 3文件,它不遵守我提供的css規則,雖然它在玩Play Books android應用程序時嘗試正確。

請注意,我已經操縱相關的Web視圖,如幾大特點:

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

,這是使用的尋呼CSS這爲工程前面提到完美的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; 
} 

請請注意,這是我如何整合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> 

回答

2

就像你可以看到你在他的css中使用這個var widthplaceholderpx。通常它應該在Java代碼中覆蓋它。但是當bodyplaceholder被添加到HTML中的正文中時,我需要再次覆蓋widthplaceholderpx。所以CSS會知道實際的高度是多少。