子视图的内容更改时,滚动视图不会调整大小 [英] Scroll view doesn't resize when the content of child view changes
问题描述
我在 ScrollView
中有一个 WebView
.
WebView
的内容在显示不同的html页面时会发生动态变化.
The content of WebView
dyanamically changes when it displays different html page.
我有以下问题:
例如,我有 A.html
和 B.html
. B.html
的内容大于 A.html
的内容,因此页面更长.
For example I have A.html
, and B.html
. The content of B.html
is larger than A.html
, so the page is longer.
当 WebView
加载 B.html
时,ScrollView会拉伸其大小以使自身能够滚动B.html,然后如果我回到 A.html
,ScrollView不会自动调整大小.(滚动区域超出了 A.html
的内容)
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
)
我想要的是动态更改滚动视图的滚动区域以适合Web视图的内容.
What I want to have, is dynamic change the scroll area of scroll view to fit the webview's content.
推荐答案
将WebView放置在ScrollView中不是一个好主意.WebView足够聪明,可以单独显示滚动条.
That's not good idea to place WebView inside of ScrollView. WebView is smart enough to show scrollbars by itself.
这篇关于子视图的内容更改时,滚动视图不会调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!