How to safely turn WebView zooming on and off as needed

前端 未结 9 1263
后悔当初
后悔当初 2020-12-15 01:06

As mentioned in this unanswered question: WebView throws Receiver not registered: android.widget.ZoomButtonsController

By turning the WebView zoom controls on and of

9条回答
  •  忘掉有多难
    2020-12-15 01:56

    webView.getSettings().setBuiltInZoomControls(true); did not work for me.

    dkneller's suggestion did work, however:

        long timeout = ViewConfiguration.getZoomControlsTimeout();
        new Timer().schedule(new TimerTask() {
            @Override
            public void run() {
                webview.destroy();
            }
        }, timeout);
    

提交回复
热议问题