中的getScale()是pcated在API级别17所以去$ P $,我怎样才能得到一个web视图当前的规模。 我试图覆盖的方法onScaleChanged,但那倒被称为除非我改变的规模...
解决方案我知道这个问题是有点老了,但是这可能会帮助一个人(比如我),尤其是如果有人想覆盖的WebView,并添加onTouch监听器,来检测的WebView内容结束。
您可以使用:
getResources()。getDisplayMetrics()。密度
而不是
webView.getScale()
这是德precated。
这是相同的值,即重新presents屏幕像素密度,相比 MDPI
值。
因此,这将是如下:
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:
相关推荐
最新文章