的WebView loaddata滚动设定不更新,直到点击 [英] webview loaddata scroll setting not updating till clicked

查看:199
本文介绍了的WebView loaddata滚动设定不更新,直到点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我更新使用loadData在网页视图的HTML(),其次是重载()。我得到的新的数据,以显示,但网页的滚动尚未更新。我想保持页面视图在底部。我可以等待很长的时间,它仍然不会更新。一旦我点击web视图滚动条调整,我可以拖动到页面的底部,看到了新的文本。

I update the html in a webView using loadData() followed by a reload(). I get the new data to display but the scroll of the page has not updated. I want to keep the view of the page at the bottom. I can wait a long time and it still doesn't update. Once I click the webView the scroll bars adjust and I can drag to the bottom of the page and see the new text.

东西我曾尝试:
- 多种设置和调用onPageFinished()。无工作是因为getContentHeight()尚未改变。我也试图scrollTo(100 + getContentHeight)和不工作。
- 下页(真)

Things I have tried: - multiple settings and calls in onPageFinished(). None worked because the getContentHeight() hasn't changed yet. I have also tried to scrollTo(100 + getContentHeight) and that doesn't work. - pageDown(true)


  • 调用重载之后requestLayout()()

  • calling requestLayout() after reload()

browser.requestFocusFromTouch() - 仍然没有好,想我可以模仿我的点击

browser.requestFocusFromTouch() - still no good, thinking i could simulate my click.

添加一些BR标签。这个工作了一点,但BR的人数必须等于新的文本行数。由于新的行数是不是可以准确地确定基于方向和屏幕变量它不是一个很好的修复。
有任何想法吗? TIA

adding a few br tags. This worked a bit, but the number of br's has to equal the number of lines of new text. Since the number of new lines is not something that can be exactly determined based on orientation and screen variables it's not a good fix. Any ideas? TIA

推荐答案

如果您希望它完成装车后的WebView要滚动至底部,我发现我已经在onNewPicture使用下页(真)。 (我相信这是当一个视图画完触发事件)。

If you want the webview to be scrolled to the bottom after it's finished loading, I found I had to use pageDown(true) in onNewPicture. (I believe that's the event fired when a view is finished drawing.)

所以,code看起来像

So the code looks something like

   webView.setPictureListener( new WebView.PictureListener() {

        public void onNewPicture(WebView view, Picture picture) {
            webView.pageDown(true);
        }
    }

使用下页有明显的滚动页面不幸的问题;我有发现任何其他方式跳转到web视图底部的问题,发现了这个问题,而寻找一个解决方案! (我还没有尝试达到的WebView内使用javascript然而,虽然。)

Using pageDown has the unfortunate problem of visibly scrolling the page; I'm having problems finding any other way to jump to the bottom of the webView, found this question while looking for a solution! (I haven't tried reaching inside the WebView and using javascript yet, though.)

这篇关于的WebView loaddata滚动设定不更新,直到点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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