要在加载到之前获取水平分页添加css
属性html
WebView
String html = getBookContent(); // load epub content to String
int density = getResources().getDisplayMetrics().density;
int width = (int) Math.floor(mWebView.getWidth() / density);
int height = (int) Math.floor(mWebView.getHeight() / density);
String style= "<meta name=\"viewport\" content=\"width=device-width, height=device-height, initial-scale=1\"/>\n" +
"<style type=\"text/css\">body {height: %heightpx; \n" +
"-webkit-column-width: %widthpx; -webkit-column-gap:0;}</style></head>";
html = html.replace("</head>", style);
html = html.replace("%width", String.valueOf(width));
html = html.replace("%height", String.valueOf(height));
mWebView.loadDataWithBaseURL(baseUrl, html, "text/html", "utf-8", null);