I'm developing for android using PhoneGap. Following you can see my code, what I cannot do is to reset the WebView scale to 1 after user changed the scale.
The reset code should be implement in "DisableZoom" method.
public class App extends DroidGap {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
this.appView.addJavascriptInterface(new __Funcs(this.appView), "__FUNCS");
}
public class __Funcs{
WebView appView;
public __Funcs(WebView appView){
this.appView = appView;
}
public void EnableZoom(){
this.appView.getSettings().setSupportZoom(true);
this.appView.getSettings().setBuiltInZoomControls(true);
}
public float DisableZoom(){
this.appView.getSettings().setBuiltInZoomControls(false);
this.appView.getSettings().setSupportZoom(false);
this.appView.getSettings().setDefaultZoom(ZoomDensity.FAR);
return this.appView.getScale();
}
}
}
I think the only way to reset the zoom to the initial value is to use the viewport settings for setup of the initial scale and to relaod the page. In my tests for android Phonegap apps getSettings().setLoadWithOverviewMode(true)
only worked, if there have been no settings in place via viewport.