Android WebView:如何在不同页面之间水平滚动?
我有几个 HTML 页面,我希望它们能够水平滚动,就像阅读一本书或一本杂志一样。但我希望每个页面在滚动时都能卡入到位,而不是完全平滑的水平滚动。
我可以采取什么最好的方法来做到这一点?
I have several HTML pages that I'd like to be able to scroll horizontally, kind of like how you would read a book or a magazine. But instead of a totally smooth scrolling horizontally, I would like each page to kind of click into place as I scroll.
What is the best way I can go about doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许将
ViewFlipper
与多个WebViews
一起使用,并在翻转视图时添加动画。此外,您还必须添加
GestureDetector
并实现onFling()
方法。根据您拥有的网页数量,您可能希望限制
WebView
实例的数量并重新使用它们,并在显示时加载另一个页面。Maybe use a
ViewFlipper
with multipeWebViews
and add animations when you flipp through your views.Also you would have to add a
GestureDetector
and implement theonFling()
method.Depending on how many webpages you have you might want to limit the amount of
WebView
instances and resuse them and just load another page when they are shown.