user848106
user848106

Reputation: 335

Android WebView scrolling within ScrollView

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?

Upvotes: 1

Views: 2003

Answers (2)

Roman Truba
Roman Truba

Reputation: 4401

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

Upvotes: 0

Booger
Booger

Reputation: 18725

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".

Upvotes: 1

Related Questions