Reputation: 83
I found the way to enable/disable zoom controls in Android WebView from following question.
How to remove zoom buttons on Android webview?
I'm using NativeScript and I don't see similar method in NativeScript WebView. Is there any way I can access the methods of Android WebView from NativeScript? Or, is there any other way?
Thanks.
Upvotes: 6
Views: 5130
Reputation: 715
Just add this meta tag to header of your html
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
Upvotes: 11
Reputation: 1091
In NS + Angular:
import { WebView, LoadEventData } from "ui/web-view";
...
//Get the element ref from the view #webView
@ViewChild("webView") webView: ElementRef;
...
//Get the real object type casted
let webview: WebView = this.webView.nativeElement;
if(webview.android) {
webview.android.getSettings().setBuiltInZoomControls(false);
}
Upvotes: 5
Reputation: 1131
You can get hold of the actual android trough the android
property of your WebView. So you can probably use something like that in the loaded event:
var webView = page.getViewById("webViewID");
if(webView.android) { // in IOS android will be undefined
webView.android.getSettings().setBuiltInZoomControls(false);
}
Upvotes: 11