9

解决了

只需将它放在 oncreate 中:奇怪的是只会在“android 浏览器”中打开

        //webview settings
        myWebView = (WebView) findViewById(R.id.calwebview);
        myWebView.setBackgroundColor(Color.BLACK);
        myWebView.setWebViewClient(new MyWebViewClient());
        WebSettings webSettings = myWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setSupportMultipleWindows(true);
        myWebView.loadUrl("www.google.com");    
        myWebView.setWebChromeClient(new WebChromeClient() {
                @Override public boolean onCreateWindow(WebView view, boolean dialog, boolean userGesture, Message resultMsg)
                {
                    WebView newWebView = new WebView(view.getContext());
                    WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
                    transport.setWebView(newWebView);
                    resultMsg.sendToTarget();
                    return true;
                }
            });
4

0 回答 0