Android WebView scrolling within ScrollView

Go To


Very general question: I have multiple widgets in a ScrollView Android app. A standard ScrollView, mobile can show say 720 lines and user can scroll down then back up going thru multiple widgets (text panes, buttons etc). Problem is that I want to add a WebView that will display an HTML table; the height of this HTML table will be variable size.

Is there a way to change the height of the WebView based on the size of the HTML table it should display?

2012-04-04 03:39
by user848106


Yes, you can get a reference to the WebView, then set the height of it, with the setHeight attribute.

Maybe you would be better off letting the container take care of that for you, and set the attribute to "wrap_content".

2012-04-04 04:09
by Booger


I guess, you need to calc web-view content size (here and here and enter link description here), than set webview size to content fits (maybe here). In that way you should have only scrollview scrolling.

Good luck

2012-04-04 04:47
by Roman Truba