How get webview scale in Android 4 -


webview.getscale() deprecated (but still usable)

the recommended way scale webview use webviewclient.onscalechanged() http://developer.android.com/reference/android/webkit/webviewclient.html#onscalechanged(android.webkit.webview, float, float)

i've added corresponding handler in custom webview:

public class customwebview extends webview {  public customwebview(context context) {     super(context);     setwebviewclient(new webviewclient() {         @override         public void onscalechanged(webview view, float oldscale, float newscale) {             super.onscalechanged(view, oldscale, newscale);             currentscale = newscale         }     }); } 

and problem: method not invoked (at least on nexus 7) if i'm zoom in/zoom out using pinch, works if use zoom controls button.

i'm developing api level 17 , ended using deprecated method getscale() same reason. webviewclient.onscalechanged() wasn't triggered when changed scale using pinch zoom in webview. have custom gesturelistener in extended webview behaves differently when view zoomed in (scale 1.0+). couldn't reliably proper scale value when set class variable in onscalechanged().


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -