Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setSupportZoom in Kotlin

I know that there is a way to support zoom in java: webview.getSettings().setSupportZoom(true). But I've been searching for a while for this in Kotlin. And yes, I have tried using the converter try.kotlinlang.org but It gives me the same piece of code. Does somebody know how to support zoom in Kotlin?

like image 414
Amy Avatar asked Nov 07 '22 03:11

Amy


1 Answers

Why not simply:

var webView: WebView = view.findViewById(R.id.webview)
webView.settings.setSupportZoom(true)

Update

As per your comments you would want to do this as well:

webView.settings.builtInZoomControls = true // enable pinch to zoom and zoom controls
webView.settings.displayZoomControls = false // hides the zoom controls so you can just pinch to zoom
like image 183
David Kroukamp Avatar answered Nov 15 '22 08:11

David Kroukamp