如何获得宽度的android一个web视图和高度 [英] How to get width and height of a Webview in android

查看:87
本文介绍了如何获得宽度的android一个web视图和高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要确定宽度和。我一直使用已经尝试过的web视图的高度

I want to determine the width and the height of the webview .i have already tried using

webView.getWidth();
webView.getHeight();

但日志总是告诉他们0。 任何帮助将AP preciated ..

but the log always show them 0. any help will be appreciated..

感谢....

推荐答案

onPageFinished 回调方法不使用时正常工作 loadData loadDataWithBaseURL 。我看到 Andromedev另一种解决方案使用JavaScript,但我不相信,这是采取的最佳路径。

The onPageFinished call back approach does not work when using loadData or loadDataWithBaseURL. I saw another solution on Andromedev using JavaScript, but I'm not convinced that this is the best path to take.

这篇关于如何获得宽度的android一个web视图和高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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