【问题标题】:Implementing HTML book-like pagination实现 HTML 书本式分页
【发布时间】:2011-06-24 17:19:18
【问题描述】:

我在HTML book-like pagination 找到了一个解决方案,我无法使用 eclipse 3.6 在 android 上实现相同的解决方案。我使用的代码如下:

    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

标签: android html xml pagination epub


【解决方案1】:

我找到了这个解决方案,它对我有用。在 HTML book-like pagination 上尝试 Nacho L 解决方案?

【讨论】:

    猜你喜欢
    • 2011-04-07
    • 1970-01-01
    • 2016-07-23
    • 2023-04-05
    • 2023-04-06
    • 2010-09-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多