我怎样才能得到一个web视图当前的规模​​(机器人)视图、机器人、规模、web

由网友(记忆堆)分享简介:中的getScale()是pcated在API级别17所以去$ P $,我怎样才能得到一个web视图当前的规模​​。我试图覆盖的方法onScaleChanged,但那倒被称为除非我改变的规模... 解决方案 我知道这个问题是有点老了,但是这可能会帮助一个人(比如我),尤其是如果有人想覆盖的WebView,并添加on...

中的getScale()是pcated在API级别17所以去$ P $,我怎样才能得到一个web视图当前的规模​​。 我试图覆盖的方法onScaleChanged,但那倒被称为除非我改变的规模...

解决方案

我知道这个问题是有点老了,但是这可能会帮助一个人(比如我),尤其是如果有人想覆盖的WebView,并添加onTouch监听器,来检测的WebView内容结束。

您可以使用:

  getResources()。getDisplayMetrics()。密度
 

而不是

  webView.getScale()
 

这是德precated。

这是相同的值,即重新presents屏幕像素密度,相比 MDPI 值。 因此,这将是如下:

LDPI:0.75 MDPI:1.0 华电国际:1.5 xhdpi:2.0 xxhdpi:3.0 xxxhdpi:4.0

getScale () was deprecated in API level 17. so , how can i get the current scale of a webview. i tried to override the method onScaleChanged, but it won`t be called unless i change the scale...

解决方案

I know this question is a bit old, but this may help someone (like me), especially if someone wants to override WebView and add onTouch listener, to detect WebView's content end.

You can use:

getResources().getDisplayMetrics().density

instead of

webView.getScale()

which is deprecated.

It is the same value, that represents screen density, compared to mdpi value. So, it will be as follows:

ldpi: 0.75 mdpi: 1.0 hdpi: 1.5 xhdpi: 2.0 xxhdpi: 3.0 xxxhdpi: 4.0
阅读全文

相关推荐

最新文章