简体   繁体   中英

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?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM