Search code examples
androidwebviewscrollview

Scroll view doesn't resize when the content of child view changes


I have a WebView inside the ScrollView.

The content of WebView dyanamically changes when it displays different html page.

I have the following issue:

For example I have A.html, and B.html. The content of B.html is larger than A.html, so the page is longer.

When WebView load B.html, the ScrollView stretches its size to enable itself scroll for B.html, then if I go back to A.html, ScrollView doesn't resize itself. (The scroll area is exceed the content of A.html)

alt text

What I want to have, is dynamic change the scroll area of scroll view to fit the webview's content.


Solution

  • That's not good idea to place WebView inside of ScrollView. WebView is smart enough to show scrollbars by itself.