4
我发现这个解决方案有点在HTML book-like pagination我不能在android上使用eclipse 3.6实现相同。我正在使用的代码如下:实现HTML书样分页
mWebView.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
// Column Count is just the number of 'screens' of text. Add one for partial 'screens'
int columnCount = Math.floor(view.getHeight()/view.getWidth())+1;
// Must be expressed as a percentage. If not set then the WebView will not stretch to give the desired effect.
int columnWidth = columnCount * 100;
String js = "var d = document.getElementsByTagName('body')[0];" + "d.style.WebkitColumnCount=" + columnCount + ";" + "d.style.WebkitColumnWidth='" + columnWidth + "%';";
mWebView.loadUrl("javascript:(function(){" + js + "})()");
}
});
mWebView.loadUrl("file:///android_asset/chapter.xml");
LogCat显示显示给我的宽度和高度都是0.我把它放在错误的地方?任何帮助,将不胜感激。
谢谢
欢迎使用stackoverflow,请使用选择代码并点击'{}'按钮,并且不要害怕使用一些返回和制表符:P – meo