子视图的内容更改时,滚动视图不会调整大小

编程入门 行业动态 更新时间:2024-10-09 23:13:50
本文介绍了子视图的内容更改时,滚动视图不会调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在 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.

更多推荐

子视图的内容更改时,滚动视图不会调整大小

本文发布于:2023-07-09 21:04:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1088203.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:视图   大小   内容

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!