Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NativeScript: How do I disable zoom controls in WebView?

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.

like image 222
Ei Maung Avatar asked Apr 23 '16 07:04

Ei Maung


People also ask

Does NativeScript use WebView?

It uses WebView for rendering. NativeScript is the open source framework to build truly native mobile apps with Angular, Typescript and Javascript. It directly communicates with Native APIs so we can access it via JS. Unlike Cordova, it doesn't use a WebView-based wrapper.


1 Answers

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);
}
like image 64
Alexander Vakrilov Avatar answered Sep 23 '22 20:09

Alexander Vakrilov