I found a solution for this somewhat in HTML-like pagination I cannot implement the same on android using eclipse 3.6. The code I use is as follows:
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");
Does LogCat show that the width and height displayed for me are 0. Are I putting it in the wrong place? Any help would be appreciated.
thanks
source share