当调用ScrollTo上的WebView [英] When to call ScrollTo on a WebView

查看:791
本文介绍了当调用ScrollTo上的WebView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在网页视图中打开一个网站,然后把它启动一定的像素距离下跌的一页。

I want to open a website in a WebView and then have it start a certain pixel distance down the page.

我看到的WebView有scrollTo()方法,但最快的时候,我可以把这个,我如何检测?

I see the WebView has a scrollTo() method, but when is the soonest I can call this and how do I detect that?

我想有它显示给用户,该页面的滚动位置打开。所以,我不想等到整个页面加载。如果它没有等待,则用户可能已经开始滚动和一旦加载,scrollTo()似乎从他们抓住控制

I would like to have it appear to the user, that the page opens up at the scroll position. So I don't want to wait until the entire page is loaded. If it did wait, then the user may have already started scrolling and once it loaded, the scrollTo() would appear to grab control from them.

感谢

推荐答案

希望有另一种方式来做到这一点,但现在我使用的方法是启动一个检查循环当负载满载。它检查是否有网页视图内容的高度没有,当它的话,那么它滚动。它的工作原理是我想要的,只是似乎有点hackish的。

Hopefully there is another way to do this, but for now the method I am using is to start a checking loop when the load is fully loaded. It checks to see if the WebView has content height yet and when it does, then it scrolls. It works as I wanted, just seems a little hackish.

编辑:我发布了<一个href=\"http://stackoverflow.com/questions/4065134/is-there-a-listener-for-when-the-webview-displays-its-content/4945875#4945875\">very类似的问题,得到了这样的回答,这完美的作品。

I posted a very similar question and got this answer, which works perfectly.

这篇关于当调用ScrollTo上的WebView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆