Hi guys,
I have a WebView that I've added to a view group:
webView = new WebView(context);
addView(webView, ViewGroup.LayoutParams.WRAP_CONTENT);
This lives in my viewgroup's constructor.
Then on layout, I want to do this:
webView.measure(View.MeasureSpec.makeMeasureSpec(getWidth(),View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(3000, View.MeasureSpec.AT_MOST));
Unfortunately, unless I specify EXACTLY
, the webView.getMeasuredHeight() always returns 0
. What I want to do, is determine how big the webview wants to be so that I can lay other elements around it. I specified that I want the webview to be big enough to encompass it's content and I provided generous amount of space. So why is it still 0?
Thanks
Update 1
By the time webView gets measure() request, it should know how much data it has, no?
webView = new WebView(context);
webView.loadData("<html></html>","text/html", "utf-8");
addView(webView, new ViewGroup.LayoutParams(getWidth(), 1000));