如何改变在Android的一个web视图的内容大小? [英] How a change the content size of a webview in android?

查看:112
本文介绍了如何改变在Android的一个web视图的内容大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个滚动视图一个WebView控件。当我加载一个长期html文件到它,它会调整,以适应它。这是对的。然而,当我使用相同的控制之后又放少占用空间的HTML到它的内容的大小并没有缩水。这是一个问题,因为用户能够依然滚动短文档转换为空白。关于如何解决这个任何想法?

I have a webview control in a scrollview. when i load a long html document into it, it resizes to accommodate it. this is correct. however, when i use the same control again afterwards and put less space-consuming html into it, the content size doesn't shrink. this is a problem because the user is able to still scroll a short document into white space. any ideas on how to resolve this?

推荐答案

我也有类似的问题,并通过清除视图和重新测量与前再次加载视图中的小尺寸解决它。

I had a similar problem and resolved it by clearing the view and re-measuring with a small size prior to loading the view again.

例如。

  webView.clearView();
  webView.measure(10, 10);

这篇关于如何改变在Android的一个web视图的内容大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆