GetContentHeight() does not work properly

前端 未结 2 969
北荒
北荒 2021-01-13 19:41

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

2条回答
  •  被撕碎了的回忆
    2021-01-13 20:00

    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();
        }
    };
    

提交回复
热议问题