我想要检索的WebView内容的高度。它包含一个HTML字符串。 问题是,getContentHeight()总是返回相同的值(392),无论多久HTML的字符串。
解决方案我有这个问题,getContetHeight()以及。 首先在 WebViewClient.OnPageFinish()回调的内容高度是不是已经设置成我就是这样做是pretty的rought解决方案。
处理程序H;
可运行scroll_updater =新的Runnable(){
@覆盖
公共无效的run(){
如果(Thread.interrupted())
返回;
如果(lyrics.getContentHeight()== 0)
h.postDelayed(此,100);
setLyricsScroll();
}
};
I'm trying to retrieve the height of a webview's content. it contains a html-string. The problem is that getContentHeight() returns always the same value (392), no matter how long the html-string is.
解决方案I had this problem with getContetHeight() as well. First in the WebViewClient.OnPageFinish() callback the content height wasn't already set so what I did it's pretty rought solution.
Handler h;
Runnable scroll_updater = new Runnable() {
@Override
public void run() {
if(Thread.interrupted())
return;
if(lyrics.getContentHeight() == 0)
h.postDelayed(this, 100);
setLyricsScroll();
}
};