NativeScript:如何在 WebView 中禁用缩放控件?

问题描述:

我从以下问题中找到了在 Android WebView 中启用/禁用缩放控件的方法.

I found the way to enable/disable zoom controls in Android WebView from following question.

如何删除 Android webview 上的缩放按钮?

我正在使用 NativeScript,但在 NativeScript WebView 中没有看到类似的方法.有什么方法可以从 NativeScript 访问 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?

谢谢.

您可以通过 WebView 的 android 属性获取实际的 android.所以你可以在加载的事件中使用类似的东西:

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);
}