需要将 HTML 页面(带有 CSS)显示为具有翻页功能的书籍
所以我有一个带有CSS的本地HTML文件,我需要以一本书的形式显示这个文件(向左/向右滚动以查看上一个/下一个内容,而不是上下滚动)。我想到了一种非常复杂的方法来实现此目的:
WebView
的Gallery
- 在
WebView
中禁用滚动 - 滑动时,滚动 < code>WebView 降低了
WebView
的高度
这种方法有几个问题:
- 我必须为每个
WebView
加载 HTML 内容(效率极低) - 存在在页面底部,可能会有一些内容被部分隐藏,
我正在寻找一些关于如何解决这个问题的建议,因为我想到的唯一的事情听起来很可怕。谢谢!
So I have a local HTML file with CSS and I need to display this file in the form of a book (scroll left/right to view previous/next content, not up and down). I've thought of a really complicated ways to achieve this:
- A
Gallery
ofWebView
s - Disable scrolling in the
WebView
- On swipe, scroll the
WebView
down the height of theWebView
There's a couple of problems with this approach:
- I'd have to have the HTML content loaded for each
WebView
(extremely inefficient) - There exists the possibility that at the bottom of the page, there would be some content partially hidden
I'm looking for some suggestions on how to approach this problem, as the only thing I've came up with sounds dreadful. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以并排使用两个框架或 iframe,并在左侧框架中加载奇数页码,在右侧框架中加载偶数页码。在每个页面上放置一些精美的控制按钮,或者在框架下放置一个 JavaScript 滚动条,以及一个带有翻页动画的 div,您可以在页面加载到框架中时打开或关闭该动画。我认为这是完全可行的,而且实际上可能非常巧妙。
You could use two frames or iframes side by side and load odd page numbers in the left frame and even page numbers in the right frame. Put some fancy control buttons on each page, or a javascript scrollbar under the frames, and a div with a page-flipping animation that you can turn on or off when pages are loaded into the frames. I think it's totally doable, and could actually be pretty slick.
我无法完全帮助您,但这里有一个带有自定义视图的卷页动画的好例子。
https://github.com/harism/android_page_curl/tree/master/src/fi
I can't help you totally, but here is a good example for page curl animation with custom view.
https://github.com/harism/android_page_curl/tree/master/src/fi