WebView.getContentHeight() always returns 0
<p>I'm attempting to display an HTML string in a WebView named webDescription. Because this HTML can sometimes be lengthy, I want to limit the height of the WebView to a maximum dimension and allow the content to scroll within the view.</p>

<p>I am using the following code to wait until the page finishes loading, check the content height and set the height of the enclosing (parent) TableRow to a maximum of 150.</p>

<pre><code>    webDescription.setWebViewClient(new WebViewClient() {

        public void onPageFinished(WebView view, String url) {
            // do your stuff here
            Log.i("EVENTDETAIL", "Web view has finished loading");
            Log.i("EVENTDETAIL", "Description content height: " + view.getContentHeight());
            if ( view.getContentHeight() &gt; 150 ) {
                LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, 150);
                view.setLayoutParams(params);
            }
        }

    });
</code></pre>

<p>However, view.getContentHeight() always returns 0; thus, the LayoutParams of the parent TableRow never get changed.</p>

<p>Can anyone offer any insight into this and how I might fix my problem? Thanks so much for your consideration.</p>
